mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 06:11:47 +08:00
8.5 KiB
8.5 KiB
import type { Meta, StoryObj } from '@storybook/angular';
import { Button } from './Button.component';
const meta: Meta<Button> = {
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',
},
};
import { Button } from './Button';
export default {
component: Button,
argTypes: {
backgroundColor: { control: 'color' },
},
};
// This is an accessible story
export const Accessible = {
args: {
primary: false,
label: 'Button',
},
};
// This is not
export const Inaccessible = {
args: {
...Accessible.args,
backgroundColor: 'red',
},
};
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',
},
};
import type { Meta, StoryObj } from '@storybook/react';
import { Button } from './Button';
const meta: Meta<typeof Button> = {
component: Button,
argTypes: {
backgroundColor: { control: 'color' },
},
};
export default meta;
type Story = StoryObj<typeof 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',
},
};
import { Button } from './Button';
export default {
component: Button,
argTypes: {
backgroundColor: { control: 'color' },
},
};
// This is an accessible story
export const Accessible = {
args: {
primary: false,
label: 'Button',
},
};
// This is not
export const Inaccessible = {
args: {
...Accessible.args,
backgroundColor: 'red',
},
};
import type { Meta, StoryObj } from 'storybook-solidjs';
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',
},
};
import type { Meta, StoryObj } from 'storybook-solidjs';
import { Button } from './Button';
const meta: Meta<typeof Button> = {
component: Button,
argTypes: {
backgroundColor: { control: 'color' },
},
};
export default meta;
type Story = StoryObj<typeof 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',
},
};
import Button from './Button.svelte';
export default {
component: Button,
argTypes: {
backgroundColor: { control: 'color' },
},
};
// This is an accessible story
export const Accessible = {
render: (args) => ({
Component: Button,
props: args,
}),
args: {
primary: false,
label: 'Button',
},
};
// This is not
export const Inaccessible = {
render: (args) => ({
Component: Button,
props: args,
}),
args: {
...Accessible.args,
backgroundColor: 'red',
},
};
import type { Meta, StoryObj } from '@storybook/svelte';
import Button from './Button.svelte';
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',
},
};
import type { Meta, StoryObj } from '@storybook/svelte';
import Button from './Button.svelte';
const meta: Meta<typeof Button> = {
component: Button,
argTypes: {
backgroundColor: { control: 'color' },
},
};
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',
},
};
import Button from './Button.vue';
export default {
component: Button,
argTypes: {
backgroundColor: { control: 'color' },
},
};
// This is an accessible story
export const Accessible = {
args: {
primary: false,
label: 'Button',
},
};
// This is not
export const Inaccessible = {
args: {
...Accessible.args,
backgroundColor: 'red',
},
};
import type { Meta, StoryObj } from '@storybook/vue3';
import Button from './Button.vue';
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',
},
};
import type { Meta, StoryObj } from '@storybook/vue3';
import Button from './Button.vue';
const meta: Meta<typeof Button> = {
component: Button,
argTypes: {
backgroundColor: { control: 'color' },
},
};
export default meta;
type Story = StoryObj<typeof Button>;
// This is an accessible story
export const Accessible: Story = {
render: (args) => ({
components: { Button },
setup() {
return { args };
},
template: '<Button v-bind="args" />',
}),
args: {
primary: false,
label: 'Button',
},
};
// This is not
export const Inaccessible: Story = {
render: (args) => ({
components: { Button },
setup() {
return { args };
},
template: '<Button v-bind="args" />',
}),
args: {
...Accessible.args,
backgroundColor: 'red',
},
};
export default {
component: 'custom-button',
argTypes: {
backgroundColor: { control: 'color' },
},
};
// This is an accessible story
export const Accessible = {
args: {
primary: false,
label: 'Button',
},
};
// This is not
export const Inaccessible = {
args: {
...Accessible.args,
backgroundColor: 'red',
},
};
import type { Meta, StoryObj } from '@storybook/web-components';
const meta: Meta = {
component: 'custom-button',
argTypes: {
backgroundColor: { control: 'color' },
},
};
export default meta;
type Story = StoryObj;
// 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',
},
};