Skip to content

fix(stories): make playgrounds and disabled controls work - #101

Draft
aresnik11 wants to merge 2 commits into
mainfrom
ajr-fix-controls
Draft

aresnik11 wants to merge 2 commits into
mainfrom
ajr-fix-controls

Conversation

@aresnik11

Copy link
Copy Markdown
Contributor

Overview

This is the first phase of the Storybook story audit. The goal of the audit is to delete stories that exist only to show a single prop or variant, since the playground and its controls should cover those. Before deleting anything, the playgrounds need to actually work, so this PR fixes the playgrounds and controls that were broken or missing. Removals and merges come in a follow-up branched off this one.

disabled controls for inputs and buttons

Root cause: the propFilter in packages/.storybook/main.ts drops props that are only declared in node_modules. disabled came from React's InputHTMLAttributes/ButtonHTMLAttributes, so it never showed up in the props table or controls for Input, TextArea, Select, Radio, RadioGroup, Checkbox, or any button.

Fix: declare disabled?: boolean on BaseInputProps and ButtonBaseProps so docgen sees it in gamut source. The input components now pick or extend it from BaseInputProps instead of the HTML attribute types. The button version has a JSDoc noting that a disabled button with an href renders as a button. This fixes the type at the source rather than adding argTypes to each story, and it removes the manual disabled argTypes from the FillButton and Pagination stories.

While in there:

  • label?: string moved off BaseInputProps. FormGroup was its only real consumer, so it's declared there now (and on DatePickerInputProps, which relied on it). Radio and TextArea no longer need Omit<BaseInputProps, 'label'>.
  • Removed a redundant required redeclaration from ConnectedFormGroupBaseProps.
  • Fixed copy-pasted htmlFor JSDoc that was sitting on the wrong props (FormGroup, FormGroupLabel infotip, Input placeholder). FormGroupLabel's infotip now has its real description.
  • TextArea declares placeholder so it shows up in controls.
  • Input/FormGroupDefault passed id to FormGroup instead of htmlFor, so the label wasn't associated with the input.

Playgrounds that ignored their args

These stories either didn't spread args into the component or didn't render enough for the controls to do anything visible:

  • LayoutGrid: args are spread through, and rowHeight defaults to '75' so changes are visible.
  • GridBox: Default now starts as a four-column grid (columnGap, gridAutoColumns, gridAutoFlow in meta args) with four children. FourColumnGrid is deleted since the playground now shows the same thing, and its section in grid-box.mdx is folded into the Playground section.
  • InfoTip: Default renders the tip next to some text so placement and alignment controls have context.
  • Tabs: Default no longer force-mounts panels, so it reflects the component's real behavior. Its play checks that an inactive panel isn't rendered.
  • ListCol: the playground spreads args onto a ListCol (with a highlighted background so size, fill, and justify are visible) instead of onto the parent List. Stories are typed StoryObj<typeof ListCol> throughout, and the shared scrolling list is pulled into one helper.
  • FormGroup: Default wires htmlFor to the input's id, passes disabled/error through to the input, and its play checks the label association.
  • SelectDropdown: Default is now the first story, and inputWidth/dropdownWidth get text controls (they're string | number, which Storybook has no built-in control for).

Known limitations

  • No changeset yet. Moving label off BaseInputProps changes an exported type, so this needs one before merging.
  • A few playgrounds are deliberately left alone for later: ConnectedForm (complex, works as is), GridFormNestedCheckboxInput (field options need documenting in the GridForm docs first), and ListRow.
  • Unset boolean controls still show Storybook's "Set boolean" button. That's expected, so I didn't add default args to work around it.
  • Existing warnings that aren't from this PR: TabsNav's fill attribute warning (already ticketed) and ListCol HeaderColumnCells rendering thead inside tbody (existing TODO).
  • Some ListCol docs embeds still use old organisms- story ids. Fixing those is part of the follow-up.

Notes for reviewers

  • The ListCol diff looks big, but most of it is the story type change and the shared scrolling helper. No stories were removed there. The moves to List/TableHeader are planned for the follow-up.

PR Checklist

  • Related to designs:
  • Related to JIRA ticket:
  • Changeset added (or empty changeset if no release)
  • I have run this code to verify it works
  • This PR includes unit tests for the code change
  • This PR includes testing instructions tests for the code change
  • Package previews from this PR are passing end-to-end tests in all relevant consuming repositories

Testing Instructions

  1. Open Input, TextArea, Select, Radio, RadioGroup, Checkbox, and FillButton in Storybook and check that disabled shows up in the props table and its control disables the component.
  2. Open Input/FormGroupDefault, click the label, and check that the input gets focus.
  3. Open the LayoutGrid, GridBox, InfoTip, Tabs, ListCol, FormGroup, and SelectDropdown playgrounds and change a few controls. Each change should show up in the rendered story.
  4. On the GridBox docs page, check that the Playground section starts as a four-column grid and that the old four-column section is gone.
  5. Run yarn test:stories for the touched components and check that they pass.

PR Links and Envs

Repository PR Link
Monolith N/A
Mono N/A

🤖 Generated with Claude Code

aresnik11 and others added 2 commits December 3, 2026 16:09
Add disabled to BaseInputProps and ButtonBaseProps so Storybook's
propFilter keeps it. Move label from BaseInputProps to FormGroup,
its only consumer, and fix the FormGroupDefault story's htmlFor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Wire args through in LayoutGrid, GridBox, InfoTip, Tabs, ListCol,
FormGroup and SelectDropdown playgrounds; drop GridBox FourColumnGrid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Dec 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

@skillsoft/eslint-plugin-gamut

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/eslint-plugin-gamut@101
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/eslint-plugin-gamut@101.tgz

@skillsoft/gamut

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut@101
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut@101.tgz

@skillsoft/gamut-agent-tools

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-agent-tools@101
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-agent-tools@101.tgz

@skillsoft/gamut-codemods

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-codemods@101
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-codemods@101.tgz

@skillsoft/gamut-icons

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-icons@101
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-icons@101.tgz

@skillsoft/gamut-illustrations

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-illustrations@101
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-illustrations@101.tgz

@skillsoft/gamut-patterns

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-patterns@101
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-patterns@101.tgz

@skillsoft/gamut-styles

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-styles@101
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-styles@101.tgz

@skillsoft/gamut-tests

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-tests@101
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-tests@101.tgz

@skillsoft/variance

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/variance@101
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/variance@101.tgz

commit: d896925

@codecov

codecov Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.20%. Comparing base (7f6b1f1) to head (d896925).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##           main     #101       +/-   ##
=========================================
+ Coverage      0   77.20%   +77.20%     
=========================================
  Files         0      464      +464     
  Lines         0    32091    +32091     
  Branches      0     1494     +1494     
=========================================
+ Hits          0    24776    +24776     
- Misses        0     7308     +7308     
- Partials      0        7        +7     
Flag Coverage Δ
pull-request 77.20% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant