storybook/docs/snippets/react/button-story-click-handler.ts.mdx
Norbert de Langen c0240f8ec5
changes
2022-06-21 18:30:05 +02:00

22 lines
609 B
Plaintext

```ts
// Button.stories.ts|tsx
import React from 'react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { Button } from './Button';
export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
} as ComponentMeta<typeof Button>;
export const Basic: ComponentStoryFn<typeof Button> = () => <Button label="Hello" onClick={action('clicked')} />;
```