storybook/docs/snippets/web-components/list-story-with-subcomponents.ts.mdx
2023-02-16 09:13:06 +08:00

27 lines
509 B
Plaintext

```ts
// List.stories.ts
import type { Meta, StoryObj } from '@storybook/web-components';
import { html } from 'lit';
const meta: Meta = {
title: 'List',
component: 'demo-list',
subcomponents: { ListItem: 'demo-list-item' }, // 👈 Adds the ListItem component as a subcomponent
};
export default meta;
type Story = StoryObj;
export const Empty: Story = {};
export const OneItem: Story = {
render: () => html`
<demo-list>
<demo-list-item></demo-list-item>
</demo-list>
`,
};
```