mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
And change semantics: `docsPage:true` = `autodocs: 'tag'` and `docsPage: 'automatic'` = `autodocs: true`.
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
import type { ButtonProps } from './Button';
|
|
import { Button } from './Button';
|
|
|
|
// More on how to set up stories at: https://storybook.js.org/docs/7.0/web-components/writing-stories/introduction
|
|
const meta: Meta<ButtonProps> = {
|
|
title: 'Example/Button',
|
|
tags: ['autodocs'],
|
|
render: (args) => Button(args),
|
|
argTypes: {
|
|
backgroundColor: { control: 'color' },
|
|
onClick: { action: 'onClick' },
|
|
size: {
|
|
control: { type: 'select' },
|
|
options: ['small', 'medium', 'large'],
|
|
},
|
|
},
|
|
};
|
|
|
|
export default meta;
|
|
type Story = StoryObj<ButtonProps>;
|
|
|
|
// More on writing stories with args: https://storybook.js.org/docs/7.0/web-components/writing-stories/args
|
|
export const Primary: Story = {
|
|
args: {
|
|
primary: true,
|
|
label: 'Button',
|
|
},
|
|
};
|
|
|
|
export const Secondary: Story = {
|
|
args: {
|
|
label: 'Button',
|
|
},
|
|
};
|
|
|
|
export const Large: Story = {
|
|
args: {
|
|
size: 'large',
|
|
label: 'Button',
|
|
},
|
|
};
|
|
|
|
export const Small: Story = {
|
|
args: {
|
|
size: 'small',
|
|
label: 'Button',
|
|
},
|
|
};
|