Enable a Storybook control conditionally

I use controls in a story to see different states of a component.
Some props only make sense if some other prop is enabled.

For example, I have 3 props:

  • isEmployee – boolean
  • isActive – boolean
  • canContactInTheWeekend – boolean

Here, canContactInTheWeekend applies only if isActive is true.
To make it more clear for a developer, I’d like to disable canContactInTheWeekend toggle when isActive is false.

How can I achieve it with standard Storybook setup or via some plugins?

Leave a Comment