Skip to content

Docs: Fix select control options in the conditional controls snippet - #36513

Merged
kylegach merged 2 commits into
storybookjs:nextfrom
TheSeydiCharyyev:docs/fix-conditional-controls-snippet
Oct 6, 2026
Merged

kylegach merged 2 commits into
storybookjs:nextfrom
TheSeydiCharyyev:docs/fix-conditional-controls-snippet

Conversation

@TheSeydiCharyyev

Copy link
Copy Markdown
Member

What I did

docs/essentials/controls.mdx embeds component-story-conditional-controls-mutual-exclusion.md in the conditional controls section. In all 16 tabs the image argType keeps its options inside control:

image: {
  control: { type: 'select', options: ['foo.jpg', 'bar.jpg'] },
  if: { arg: 'label', truthy: false },
},

options is an argType property, not a control property — that is how the API reference documents it (docs/api/arg-types.mdx, "options"), and OptionsControl reads argType.options only (code/addons/docs/src/blocks/controls/options/Options.tsx). A nested options never reaches the control, so SelectControl takes its empty branch and renders - (code/addons/docs/src/blocks/controls/options/Select.tsx). Anyone who copies this example gets a select with no options, and the page is about conditional controls, so the example is likely to be copied.

I moved options next to control, which is what the other snippet on the same page already does (arg-types-if.md: parent: { control: 'select', options: ['one', 'two', 'three'] }).

Same defect as #36438, which is about the same shape in the core template stories.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Documentation snippets only, so there is nothing to assert in a test.

Manual testing

The snippet itself is not executable, so the check is on the shape it teaches:

  1. Put the old shape in a story: image: { control: { type: 'select', options: ['foo.jpg', 'bar.jpg'] } }
  2. Open the story and look at the Controls panel: the image row renders - and the console gets Select with no options: image.
  3. With the new shape (control: 'select' plus a sibling options) the select renders with both options.

I ran the same code path at runtime for the radio variant in #36440: with the options nested in control, three radio rows rendered as -; after moving options up, the groups render. SelectControl has the same empty branch as RadioControl.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

The `image` argType kept its options inside `control`, but `options` is an
argType property, so `OptionsControl` never saw them and the select rendered
as "-". Move `options` next to `control` in all tabs, matching the other
snippet on the same page.
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 63b91244-5f0e-472f-ab24-ba21772732e8
📥 Commits

Reviewing files that changed from the base of the PR and between e8f7aee and 252ad86.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 4391d1b9-a3f3-44b4-a863-618bda2ce56d

📥 Commits

Reviewing files that changed from the base of the PR and between 116e586 and e8f7aee.

📒 Files selected for processing (1)
  • docs/_snippets/component-story-conditional-controls-mutual-exclusion.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The documentation updates the image argType in 16 Button story examples. Each example now declares the select control separately from its two options. The label and image mutual-exclusion conditions remain unchanged.

Changes

Conditional controls

Layer / File(s) Summary
Image select options
docs/_snippets/component-story-conditional-controls-mutual-exclusion.md
All 16 examples now declare control: 'select' and list 'foo.jpg' and 'bar.jpg' in a separate options array. The mutual-exclusion conditions remain unchanged.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to e8f7a

The examples now show select choices alongside the control as expected. No actionable merge risk remains.

Architecture Summary

Architecture risk: 🔵 Low · up to e8f7a

The change affects 1 system.

Changed systems: docs

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — docs (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in docs/_snippets/component-story-conditional-controls-mutual-exclusion.md: In the Angular CSF 3 example, the image control changes from a combined control-and-options object to control: 'select' with the same two options listed separately.
  • observed — Modified behavior in docs/_snippets/component-story-conditional-controls-mutual-exclusion.md: In the Angular CSF Next example, the image control changes from a combined control-and-options object to control: 'select' with the same two options listed separately.
  • observed — Modified behavior in docs/_snippets/component-story-conditional-controls-mutual-exclusion.md: In the Svelte CSF module example, the image control changes from a combined control-and-options object to control: 'select' with the same two options listed separately.
  • observed — Modified behavior in docs/_snippets/component-story-conditional-controls-mutual-exclusion.md: In the Svelte JavaScript CSF 3 example, the image control changes from a combined control-and-options object to control: 'select' with the same two options listed separately.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@TheSeydiCharyyev TheSeydiCharyyev added ci:docs Run the CI jobs for documentation checks only. documentation labels Oct 4, 2026
@storybook-contribution-review storybook-contribution-review Bot added qa:skip Pull Requests that do not need any QA. (e.g. documentation) sev:S4 Low priority. Wait for community PRs. labels Oct 5, 2026
@kylegach kylegach self-assigned this Oct 6, 2026

@kylegach kylegach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for catching this, @TheSeydiCharyyev!

@kylegach kylegach added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Oct 6, 2026
@kylegach
kylegach merged commit 831ed48 into storybookjs:next Oct 6, 2026
33 of 40 checks passed
@github-actions github-actions Bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:docs Run the CI jobs for documentation checks only. documentation patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch qa:skip Pull Requests that do not need any QA. (e.g. documentation) sev:S4 Low priority. Wait for community PRs.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants