storybook/docs/snippets/angular/list-story-expanded.ts.mdx
2022-07-07 19:05:48 +01:00

56 lines
1.2 KiB
Plaintext

```ts
// List.stories.ts
import { Meta, moduleMetadata, Story } from '@storybook/angular';
import { CommonModule } from '@angular/common';
import { List } from './list.component';
import { ListItem } from './list-item.component';
export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/7.0/angular/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'List',
component: List,
decorators: [
moduleMetadata({
declarations: [List, ListItem],
imports: [CommonModule],
}),
],
} as Meta;
// Always an empty list, not super interesting
export const Empty: Story = {
render: (args) => ({
props: args,
template: '<app-list></app-list>',
}),
};
export const OneItem: Story = {
render: (args) => ({
props: args,
template: `
<app-list>
<app-list-item></app-list-item>
</app-list>`,
}),
};
export const ManyItems: Story = {
render: (args) => ({
props: args,
template: `
<app-list>
<app-list-item></app-list-item>
<app-list-item></app-list-item>
<app-list-item></app-list-item>
</app-list>
`,
}),
};
```