storybook/docs/snippets/vue/button-story-with-args.js.mdx
2020-12-21 15:39:09 -05:00

22 lines
473 B
Plaintext

```js
// Button.stories.js
import Button from './Button';
export default { title: 'Components/Button' };
// We create a “template” of how args map to rendering
const Template = (args, { argTypes }) => ({
components: { Button },
props: Object.keys(argTypes),
template: '<Button v-bind="$props" v-on="$props" />',
});
// Each story then reuses that template
export const Primary = Template.bind({});
Primary.args = {
primary: true,
label: 'Primary',
};
```