storybook/docs/snippets/svelte/button-story-with-args.native-format.mdx
2022-11-17 16:33:22 +01:00

23 lines
541 B
Plaintext

```html
<!-- Button.stories.svelte -->
<script>
import { Meta, Template, Story } from '@storybook/addon-svelte-csf';
import Button from './Button.svelte';
</script>
<Meta title="Button" component={Button} argTypes={{ label: { control: 'text' }, primary: { control:
'boolean' }, }} />
<!--👇 We create a “template” of how args map to rendering -->
<template let:args>
<button {...args} />
</template>
<!-- 👇 Each story then reuses that template -->
<Story name='Primary' args={{ primary: true, label: 'Button' }} />
```