storybook/docs/snippets/react/component-story-with-custom-render-function.ts-4-9.mdx
2023-05-25 21:04:33 +01:00

31 lines
598 B
Plaintext

```tsx
// MyComponent.stories.ts|tsx
import type { Meta, StoryObj } from '@storybook/react';
import { Layout } from './Layout';
import { MyComponent } from './MyComponent';
const meta = {
component: MyComponent,
} satisfies Meta<typeof MyComponent>;
export default meta;
type Story = StoryObj<typeof meta>;
// This story uses a render function to fully control how the component renders.
export const Example: Story = {
render: () => (
<Layout>
<header>
<h1>Example</h1>
</header>
<article>
<MyComponent />
</article>
</Layout>
),
};
```