storybook/docs/snippets/angular/list-story-with-subcomponents.ts.mdx
2021-09-06 22:03:15 +01:00

32 lines
628 B
Plaintext

```ts
// List.stories.ts
import { moduleMetadata } from '@storybook/angular';
import { CommonModule } from '@angular/common';
import { List } from './list.component';
import { ListItem } from './list-item.component';
export default {
component: List,
subcomponents: { ListItem }, //👈 Adds the ListItem component as a subcomponent
decorators: [
moduleMetadata({
declarations: [ListItem],
imports: [CommonModule],
}),
],
};
export const Empty = {};
export const OneItem = {
args: {},
render: (args) => ({
props: args,
template: `<list><list-item></list-item></list>`,
}),
};
```