mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 18:01:51 +08:00
25 lines
479 B
Plaintext
25 lines
479 B
Plaintext
```ts
|
|
// Button.stories.ts|tsx
|
|
|
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
import { Button } from './Button';
|
|
|
|
const meta = {
|
|
component: Button,
|
|
} satisfies Meta<typeof Button>;
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const Text = {
|
|
args: {
|
|
label: 'Hello',
|
|
onClick: action('clicked'),
|
|
},
|
|
render: ({ label, onClick }) => <Button label={label} onClick={onClick} />,
|
|
};
|
|
```
|