storybook/docs/snippets/vue/list-story-expanded.ts-4-9.mdx
2023-12-27 20:47:00 +00:00

50 lines
974 B
Plaintext

```ts
// List.stories.ts
import type { Meta, StoryObj } from '@storybook/vue3';
import List from './ListComponent.vue';
import ListItem from './ListItem.vue';
const meta = {
component: List,
} satisfies Meta<typeof List>;
export default meta;
type Story = StoryObj<typeof meta>;
/*
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
* See https://storybook.js.org/docs/api/csf
* to learn how to use render functions.
*/
export const Empty: Story = {
render: () => ({
components: { List },
template: '<List/>',
}),
};
export const OneItem: Story = {
render: () => ({
components: { List, ListItem },
template: `
<List>
<list-item/>
</List>`,
}),
};
export const ManyItems: Story = {
render: (args) => ({
components: { List, ListItem },
template: `
<List>
<list-item/>
<list-item/>
<list-item/>
</List>`,
}),
};
```