mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 15:41:57 +08:00
24 lines
665 B
Plaintext
24 lines
665 B
Plaintext
```ts
|
|
// MyComponent.story.ts|tsx
|
|
|
|
import React from 'react';
|
|
|
|
import type { ComponentStoryObj, ComponentMeta } from '@storybook/react';
|
|
|
|
import { MyComponent } from './MyComponent';
|
|
|
|
export default {
|
|
/* 👇 The title prop is optional.
|
|
* See https://storybook.js.org/docs/7.0/react/configure/overview#configure-story-loading
|
|
* to learn how to generate automatic titles
|
|
*/
|
|
title: 'Path/To/MyComponent',
|
|
component: MyComponent,
|
|
} as ComponentMeta<typeof MyComponent>;
|
|
|
|
export const Basic: ComponentStoryObj<typeof MyComponent> = {};
|
|
|
|
export const WithProp: ComponentStoryObj<typeof MyComponent> = {
|
|
render: () => <MyComponent prop="value" />,
|
|
};
|
|
``` |