mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:01:21 +08:00
26 lines
616 B
Plaintext
26 lines
616 B
Plaintext
```ts
|
|
// List.stories.ts
|
|
|
|
import { Meta, moduleMetadata, Story } from '@storybook/angular';
|
|
import { ListItemComponent } from './list-item.component';
|
|
import { ListComponent } from './list.component';
|
|
|
|
export default {
|
|
title: 'List',
|
|
component: ListComponent,
|
|
subcomponents: { ListItemComponent }, //👈 Adds the ListItem component as a subcomponent
|
|
} as Meta;
|
|
|
|
const Template: Story<ListComponent> = (args) => ({
|
|
props: args,
|
|
moduleMetadata: {
|
|
declarations: [ListComponent, ListItemComponent],
|
|
},
|
|
});
|
|
|
|
export const OneItem = Template.bind({});
|
|
OneItem.args = {
|
|
items: [ListItemComponent],
|
|
};
|
|
```
|