mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 21:41:46 +08:00
30 lines
704 B
Plaintext
30 lines
704 B
Plaintext
```html
|
|
<!--Table.stories.svelte -->
|
|
|
|
<script>
|
|
import { Meta, Template, Story } from '@storybook/addon-svelte-csf';
|
|
|
|
import Table from './Table.svelte';
|
|
</script>
|
|
|
|
<Meta title="Custom Table" component={Table} argTypes={{ size: { options: ['small', 'medium',
|
|
'large'], }, }} />
|
|
|
|
<template let:args>
|
|
<table {...args}>
|
|
<tbody>
|
|
{#each args.data as row}
|
|
<tr>
|
|
{#each row as col}
|
|
<td>{col}</td>
|
|
{/each}
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</template>
|
|
|
|
<!-- 👇 The data arg is for the story component and the remaining args get passed to the Table component -->
|
|
<Story name="Numeric" args={{ data: [ [1, 2, 3], [4, 5, 6], ], size: 'large', }} />
|
|
```
|