Skip to content

Conversation

aresnik11
Copy link
Contributor

@aresnik11 aresnik11 commented Sep 29, 2025

Overview

We've integrated the storybook-addon-deep-controls package into our Storybook setup to enhance the developer experience when working with complex, nested object props in our component stories. This addon transforms the way we interact with deeply nested properties by breaking them down into individual, user-friendly controls instead of requiring manual JSON editing.

How It Works

The addon automatically detects nested object properties in component args and creates individual controls for each primitive property within the nested structure. Instead of seeing a single JSON editor for complex objects, developers now see separate, typed controls for each nested property.

Key Technical Implementation:

  1. Automatic Generation: The addon automatically splits any defined object args into multiple primitive controls for each deep primitive property passed into args. See Alert as an example.

  2. Dot Notation: If you need/want to customize the argType beyond what is inferred automatically, you can access the nested properties using dot notation in argTypes, such as:

  • 'tipProps.placement' for tooltip placement options
  • 'infotip.emphasis' for infotip emphasis levels
  • 'popoverProps.beak' for popover beak positioning
  1. Type Safety: Stories that are customizing nested properties will have a TS error and will need to use TypeWithDeepControls<Meta<typeof Component>> instead of the standard Meta<typeof Component> to enable proper TypeScript support for deep controls.
Screenshot 2025-10-08 at 4 34 30 PM Screenshot 2025-10-08 at 4 45 39 PM

PR Checklist

  • Related to designs:
  • Related to JIRA ticket: GM-1255
  • 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
  • The alpha package of this PR is passing end-to-end tests in all relevant Codecademy repositories

Testing Instructions

  1. Go to all button stories
  2. Confirm the size and icon controls work as expected
  3. Go to Input story
  4. Confirm icon control works as expected
  5. Go to Select and SelectDropdown stories
  6. Confirm value control works as expected
  7. Go to Modal story
  8. Confirm stories still work as expected
  9. Go to the IconButton story
  10. Confirm you see the new nested props! and now you can easily interact with tipProps
  11. Repeat for nested props in FormGroup, Radio, Alert, Coachmark, Dialog, ConnectedFormGroup, GridForm
  12. Check it with VO
  13. Finish and do a celebratory dance

PR Links and Envs

Repository PR Link
Monolith Monolith PR
Mono Mono PR

@aresnik11 aresnik11 changed the title initial setup docs: add deep controls add on Sep 29, 2025
Copy link

nx-cloud bot commented Sep 29, 2025

View your CI Pipeline Execution ↗ for commit 5e59224

Command Status Duration Result
nx run-many --target=build --all ✅ Succeeded 2s View ↗
nx run-many --target=verify --parallel=3 --all ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-17 20:20:05 UTC

@aresnik11 aresnik11 marked this pull request as ready for review October 8, 2025 20:47
@aresnik11 aresnik11 requested a review from a team as a code owner October 8, 2025 20:47
Copy link
Member

@jakemhiller jakemhiller left a comment

Choose a reason for hiding this comment

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

this
is
really
nice

Copy link
Contributor

@LinKCoding LinKCoding left a comment

Choose a reason for hiding this comment

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

Looking good! 🔥🔥
I saw some things that could use some touch-ups, so left some thoughts/Qs.

@aresnik11 aresnik11 requested a review from LinKCoding October 13, 2025 15:14
Copy link
Contributor

@dreamwasp dreamwasp left a comment

Choose a reason for hiding this comment

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

looks great to me - only nits are maybe some DRYing up can happen with infotip since its nested in a few places 🔥

@codecademydev
Copy link
Collaborator

📬Published Alpha Packages:

@codecademy/[email protected]

@codecademydev
Copy link
Collaborator

🚀 Styleguide deploy preview ready!

https://68f265101b76c68dafa569f2--gamut-preview.netlify.app

Deploy Logs

@aresnik11 aresnik11 requested a review from dreamwasp October 17, 2025 17:18
Copy link
Contributor

@LinKCoding LinKCoding left a comment

Choose a reason for hiding this comment

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

Love the new docs!
Added some editorial stuff for consideration 🙏

@codecademydev
Copy link
Collaborator

📬 Published Alpha Packages:

@codecademy/[email protected]

Copy link
Contributor

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.

5 participants