storybook/docs/snippets/svelte/button-story-using-args.js.mdx
2021-05-07 18:07:39 +01:00

19 lines
525 B
Plaintext

```js
// Button.stories.js
//👇 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 = { background: '#ff0', label: 'Button' };
export const Secondary = Template.bind({});
Secondary.args = { ...Primary.args, label: '😄👍😍💯' };
export const Tertiary = Template.bind({});
Tertiary.args = { ...Primary.args, label: '📚📕📈🤓' };
```