storybook/docs/snippets/vue/checkbox-story.mdx-3.mdx.mdx
2021-10-11 19:57:39 +01:00

60 lines
1.2 KiB
Plaintext

```md
<!--- Checkbox.stories.mdx -->
import { Meta, Story, Canvas } from '@storybook/addon-docs';
import Checkbox from './Checkbox.vue';
<Meta title="MDX/Checkbox" component={Checkbox} />
<!-- Render functions are a framework specific feature to allow you control on how the component renders -->
# 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={(args) => ({
components: { Checkbox },
setup() {
return { args };
},
template: '<Checkbox v-bind="args" />',
})} />
<Story
name="Checked"
args={{
label: 'Unchecked',
checked: true
}}
render={(args) => ({
components: { Checkbox },
setup() {
return { args };
},
template: '<Checkbox v-bind="args" />',
})} />
<Story
name="Secondary"
args={{
label: 'Secondary',
checked: true,
appearance: 'secondary'
}}
render={(args) => ({
components: { Checkbox },
setup() {
return { args };
},
template: '<Checkbox v-bind="args" />',
})} />
</Canvas>
```