Skip to content

How to show controls for a story in docs #29445

Answered by smlimasu
scurk1415 asked this question in Help
Discussion options

You must be logged in to vote

If your setup is that you write your Docs with mdx manually, you would need to have a Canvas-Block and a Controls-Block for every story. Writing MDX. Jump directly to the Autodocs explanation further down if you don't write docs pages in mdx.

Example MDX:

{/* Checkbox.mdx */}
 
import { Canvas, Controls, Subheading } from '@storybook/blocks';
 
import * as CheckboxStories from './Checkbox.stories';

<Subheading>Unchecked</Subheading>
<Canvas of={CheckboxStories.Unchecked} />
<Controls of={CheckboxStories.Unchecked} />

<Subheading>Unchecked</Subheading>
<Canvas of={CheckboxStories.Checked} />
<Controls of={CheckboxStories.Checked} include={['label']}  exclude={['background']} />

//and so…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@scurk1415
Comment options

@smlimasu
Comment options

Answer selected by scurk1415
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants