mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 21:41:46 +08:00
34 lines
567 B
Plaintext
34 lines
567 B
Plaintext
```ts
|
|
// Button.stories.ts|tsx
|
|
|
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
|
|
import { Button } from './Button';
|
|
|
|
const meta = {
|
|
component: Button,
|
|
argTypes: {
|
|
backgroundColor: { control: 'color' },
|
|
},
|
|
} satisfies Meta<typeof Button>;
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
// This is an accessible story
|
|
export const Accessible: Story = {
|
|
args: {
|
|
primary: false,
|
|
label: 'Button',
|
|
},
|
|
};
|
|
|
|
// This is not
|
|
export const Inaccessible: Story = {
|
|
args: {
|
|
...Accessible.args,
|
|
backgroundColor: 'red',
|
|
},
|
|
};
|
|
```
|