storybook/docs/snippets/web-components/button-story-click-handler-args.ts.mdx
2023-02-16 09:13:06 +08:00

27 lines
509 B
Plaintext

```ts
// Button.stories.ts
import { html } from 'lit';
import type { Meta, StoryObj } from '@storybook/web-components';
import { action } from '@storybook/addon-actions';
const meta: Meta = {
title: 'Button',
component: 'custom-button',
};
export default meta;
type Story = StoryObj;
export const Text: Story = {
render: ({ label, onClick }) =>
html`<custom-button label="${label}" @click=${onClick}></custom-button>`,
args: {
label: 'Hello',
onClick: action('clicked'),
},
};
```