fbredius/storybook

View on GitHub
docs/snippets/vue/button-story-with-args.mdx-2.mdx.mdx

Summary

Maintainability
Test Coverage
```md
<!-- Button.stories.mdx-->

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

import Button from './Button.vue';

<Meta title="Button" component={Button} />

<!-- 👇 We create a “template” of how args map to rendering -->

export const Template = (args, { argTypes }) => ({
  props: Object.keys(argTypes),
  components: { Button },
  template: `<Button v-bind="$props" v-on="$props" />`,
});

<!-- 👇 Each story then reuses that template -->
<Story
  name="Primary"
  args={{
    primary: true,
    label: 'Button',
  }}>
  {Template.bind({})}
</Story>
```