fbredius/storybook

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

Summary

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

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

import Button from './Button.svelte';

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

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

export const Template = (args) => ({
  Component: Button,
  props: args,
});

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