storybook/docs/snippets/react/button-story-click-handler-args.ts.mdx
2023-05-25 21:04:33 +01:00

25 lines
472 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: Meta<typeof Button> = {
component: Button,
};
export default meta;
type Story = StoryObj<typeof Button>;
export const Text = {
args: {
label: 'Hello',
onClick: action('clicked'),
},
render: ({ label, onClick }) => <Button label={label} onClick={onClick} />,
};
```