storybook/docs/snippets/common/button-story-onclick-action-spy.ts-4-9.mdx
2023-09-24 15:24:56 +02:00

18 lines
440 B
Plaintext

```ts
// Button.stories.ts|tsx
// Replace your-framework with the name of your framework
import type { Meta } from '@storybook/your-framework';
import { fn } from '@storybook/test';
import { Button } from './Button';
const meta = {
component: Button,
// 👇 Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked
args: { onClick: fn() },
} satisfies Meta<typeof Button>;
export default meta;
```