storybook/docs/snippets/angular/component-story-with-custom-render-function.ts.mdx
2022-07-07 19:05:48 +01:00

41 lines
898 B
Plaintext

```ts
// MyComponent.stories.ts
import { Meta, moduleMetadata, Story } from '@storybook/angular';
import { CommonModule } from '@angular/common';
import { Layout } from './Layout.component';
import { MyComponent } from './MyComponent.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: 'MyComponent',
component: MyComponent,
decorators: [
moduleMetadata({
declarations: [Layout],
imports: [CommonModule],
}),
],
} as Meta;
export const Example: Story = {
render: () => ({
template: `
<app-layout>
<header>
<h1>Example</h1>
</header>
<article>
<app-my-component></app-my-component>
</article>
</app-layout>
`,
}),
};
```