@storybook/addon-controls
is fun, however I cannot find a way to disable control generation for a given arg. Lets say I have a component prop that is an event handler and I obviously do not want it to have a control. So I want it to appear in the list of props with the name, type and description, but no control. How do I do that?
To use the Controls addon, you need to write your stories using args. Storybook will automatically generate UI controls based on your args and what it can infer about your component. Still, you can configure the controls further using argTypes, see below.
ArgTypes are a first-class feature in Storybook for specifying the behaviour of Args. By specifying the type of an arg, you constrain the values that it can take and provide information about args that are not explicitly set (i.e., not required).
The React Context addon allows you to provide and manipulate context inside Storybook.
this was recently added: https://github.com/storybookjs/storybook/pull/11388
Essentially you should be able to use control.disable
within argTypes
for a given arg.
Suppose you have a story with foo
and bar
properties (auto-generated or otherwise) and you want to hide the foo
row completely and disable controls for the bar
row on a specific story:
MyStory.argTypes = {
foo: { table: { disable: true } },
bar: { control: { disable: true } },
};
Here's the entry in the docs.
Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With