docs/api/doc-blocks/doc-block-controls.mdx
The Controls block can be used to show a dynamic table of args for a given story, as a way to document its interface, and to allow you to change the args for a (separately) rendered story (via the Story or Canvas blocks).
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
import * as ButtonStories from './Button.stories'
<Meta of={ButtonStories} />
<Canvas of={ButtonStories.Primary} />
<Controls of={ButtonStories.Primary} />
The Controls doc block will only have functioning UI controls if you haven't turned off inline stories with the inline configuration option.
import { Controls } from '@storybook/addon-docs/blocks';
ℹ️ Like most blocks, the Controls block is configured with props in MDX. Many of those props derive their default value from a corresponding parameter in the block's namespace, parameters.docs.controls.
The following exclude configurations are equivalent:
<Controls of={ButtonStories} exclude={['style']} />
The example above applied the parameter at the component (or meta) level, but it could also be applied at the project or story level.
</details> <Callout variant="info" icon="💡">This API configures the Controls blocks used within docs pages. To configure the Controls panel, see the feature documentation. To configure individual controls, specify argTypes for each.
excludeType: string[] | RegExp
Default: parameters.docs.controls.exclude
Specifies which controls to exclude from the args table. Any controls whose names match the regex or are part of the array will be left out.
includeType: string[] | RegExp
Default: parameters.docs.controls.include
Specifies which controls to include in the args table. Any controls whose names don't match the regex or are not part of the array will be left out.
ofType: Story export or CSF file exports
Specifies which story to get the controls from. If a CSF file exports is provided, it will use the primary (first) story in the file.
sortType: 'none' | 'alpha' | 'requiredFirst'
Default: parameters.docs.controls.sort or 'none'
Specifies how the controls are sorted.
alpha, with any required controls displayed first