fbredius/storybook

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

Summary

Maintainability
Test Coverage
```js
// Button.stories.js

import Button from './Button.vue';

export default {
  /* ๐Ÿ‘‡ The title prop is optional.
  * See https://storybook.js.org/docs/vue/configure/overview#configure-story-loading
  * to learn how to generate automatic titles
  */
  title: 'Button',
  component: Button,
};

// ๐Ÿ‘‡ We create a โ€œtemplateโ€ of how args map to rendering
const Template = (args, { argTypes }) => ({
  props: Object.keys(argTypes),
  components: { Button },
});

//๐Ÿ‘‡ Each story then reuses that template
export const Primary = Template.bind({});

Primary.args = {
  primary: true,
  label: 'Button',
};
```