fbredius/storybook

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

Summary

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

import Button from './Button.svelte';

export default {
  /* ๐Ÿ‘‡ The title prop is optional.
  * See https://storybook.js.org/docs/svelte/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)=>({
  component: Button,
  props: args,
});

//๐Ÿ‘‡ Each story then reuses that template
export const Primary = Template.bind({});
Primary.args = {
  primary: true,
  label: 'Button',
};
```