storybook/docs/snippets/react/list-story-with-subcomponents.ts-4-9.mdx
Kyle Gach fd87a7f3e4 Address comments
- Update un-reverted snippets for v8
2024-01-30 10:15:12 -07:00

27 lines
544 B
Plaintext

```tsx
// List.stories.ts|tsx
import React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import { List } from './List';
import { ListItem } from './ListItem';
const meta = {
component: List,
subcomponents: { ListItem }, //👈 Adds the ListItem component as a subcomponent
} satisfies Meta<typeof List>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Empty: Story = {};
export const OneItem: Story = {
render: (args) => (
<List {...args}>
<ListItem />
</List>
),
};
```