mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 03:21:49 +08:00
37 lines
767 B
Plaintext
37 lines
767 B
Plaintext
```ts
|
|
// Button.stories.ts
|
|
|
|
import type { Meta, StoryObj } from '@storybook/angular';
|
|
|
|
import { Button } from './Button.component';
|
|
|
|
const meta: Meta<Button> = {
|
|
/* 👇 The title prop is optional.
|
|
* See https://storybook.js.org/docs/7.0/angular/configure/overview#configure-story-loading to learn how to generate automatic titles
|
|
*/
|
|
title: 'Accessibility testing',
|
|
component: Button,
|
|
argTypes: {
|
|
backgroundColor: { control: 'color' },
|
|
},
|
|
};
|
|
|
|
export default meta;
|
|
type Story = StoryObj<Button>;
|
|
|
|
// 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',
|
|
},
|
|
};
|
|
```
|