Skip to content

Commit

Permalink
Merge pull request #19977 from JohnAlbin/patch-1
Browse files Browse the repository at this point in the history
Add first MDX example for storybook/html
  • Loading branch information
jonniebigodes authored Dec 9, 2022
2 parents 59d0bcc + 1ec448e commit 4f511df
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions docs/snippets/html/checkbox-story.mdx.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
```md
<!-- Checkbox.stories.mdx -->

import { Canvas, Meta, Story } from '@storybook/addon-docs';

export const Checkbox = (args) => `<label>
${args?.label}
<input
type="checkbox"
${args?.checked ? 'checked' : ''}
${args?.appearance ? `class="${args.appearance}"` : ''}
/>
</label>`;

<Meta title="MDX/Checkbox" component={Checkbox} />

# Checkbox

With `MDX`, we can define a story for `Checkbox` right in the middle of our
Markdown documentation.

<Canvas>
<Story
name="Unchecked"
args={{
label: 'Unchecked',
}}
render={Checkbox} />
<Story
name="Checked"
args={{
label: 'Unchecked',
checked: true,
}}
render={Checkbox} />
<Story
name="Secondary"
args={{
label: 'Secondary',
checked: true,
appearance: 'secondary',
}}
render={Checkbox} />
</Canvas>
```

0 comments on commit 4f511df

Please sign in to comment.