mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 03:11:49 +08:00
31 lines
596 B
Plaintext
31 lines
596 B
Plaintext
```tsx
|
|
// MyComponent.stories.ts|tsx
|
|
|
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
|
|
import { Layout } from './Layout';
|
|
|
|
import { MyComponent } from './MyComponent';
|
|
|
|
const meta: Meta<typeof MyComponent> = {
|
|
component: MyComponent,
|
|
};
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof MyComponent>;
|
|
|
|
// 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>
|
|
),
|
|
};
|
|
```
|