storybook/docs/snippets/html/list-story-expanded.ts.mdx
2022-07-07 22:27:00 +01:00

40 lines
902 B
Plaintext

```ts
// List.stories.ts
import type { Meta, Story } from '@storybook/html';
import { createList, ListArgs } from './List';
import { createListItem } from './ListItem';
export default {
title: 'List',
} as Meta<ListArgs>;
/*
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
* See https://storybook.js.org/docs/7.0/html/api/csf
* to learn how to use render functions.
*/
export const Empty: Story = {
render: () => createList(args)
};
export const OneItem: Story = {
render: (args) => {
const list = createList(args);
list.appendChild(createListItem());
return list;
},
};
export const ManyItems: Story = {
render: (args) => {
const list = createList(args);
list.appendChild(createListItem());
list.appendChild(createListItem());
list.appendChild(createListItem());
return list;
},
};
```