docs/_snippets/addon-a11y-parameter-example.md
import type { Meta, StoryObj } from '@storybook/angular';
import { Button } from './button.component';
const meta: Meta<Button> = {
component: Button,
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
};
export default meta;
type Story = StoryObj<Button>;
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary: Story = {
args: { primary: true },
};
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail: Story = {
parameters: {
a11y: { test: 'todo' },
},
};
import preview from '../.storybook/preview';
import { Button } from './button.component';
const meta = preview.meta({
component: Button,
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
});
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary = meta.story({
args: { primary: true },
});
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail = meta.story({
parameters: {
a11y: { test: 'todo' },
},
});
// Replace your-framework with the framework you are using, e.g. react-vite, nextjs, vue3-vite, etc.
import type { Meta, StoryObj } from '@storybook/your-framework';
import { Button } from './Button';
const meta = {
component: Button,
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary: Story = {
args: { primary: true },
};
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail: Story = {
parameters: {
a11y: { test: 'todo' },
},
};
import { Button } from './Button';
export default {
component: Button,
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
};
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary = {
args: { primary: true },
};
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail = {
parameters: {
a11y: { test: 'todo' },
},
};
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import Button from './Button.svelte';
const { Story } = defineMeta({
component: Button,
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
});
</script>
<!-- ๐ This story will use the 'error' value and fail on accessibility violations -->
<Story
name="Primary"
args={{ primary: true }}
/>
<!-- ๐ This story will not fail on accessibility violations
(but will still run the tests and show warnings) -->
<Story
name="NoA11yFail"
parameters={{
a11y: { test: 'todo' },
}}
/>
// Replace your-framework with the framework you are using, e.g. sveltekit or svelte-vite
import type { Meta, StoryObj } from '@storybook/your-framework';
import Button from './Button.svelte';
const meta = {
component: Button,
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary: Story = {
args: { primary: true },
};
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail: Story = {
parameters: {
a11y: { test: 'todo' },
},
};
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import Button from './Button.svelte';
const { Story } = defineMeta({
component: Button,
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
});
</script>
<!-- ๐ This story will use the 'error' value and fail on accessibility violations -->
<Story
name="Primary"
args={{ primary: true }}
/>
<!-- ๐ This story will not fail on accessibility violations
(but will still run the tests and show warnings) -->
<Story
name="NoA11yFail"
parameters={{
a11y: { test: 'todo' },
}}
/>
import Button from './Button.svelte';
export default {
component: Button,
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
};
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary = {
args: { primary: true },
};
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail = {
parameters: {
a11y: { test: 'todo' },
},
};
import type { Meta, StoryObj } from '@storybook/web-components-vite';
const meta: Meta = {
component: 'demo-button',
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
};
export default meta;
type Story = StoryObj;
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary: Story = {
args: { primary: true },
};
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail: Story = {
parameters: {
a11y: { test: 'todo' },
},
};
export default {
component: 'demo-button',
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
};
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary = {
args: { primary: true },
};
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail = {
parameters: {
a11y: { test: 'todo' },
},
};
import preview from '../.storybook/preview';
const meta = preview.meta({
component: 'demo-button',
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
});
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary = meta.story({
args: { primary: true },
});
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail = meta.story({
parameters: {
a11y: { test: 'todo' },
},
});
import preview from '../.storybook/preview';
const meta = preview.meta({
component: 'demo-button',
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
});
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary = meta.story({
args: { primary: true },
});
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail = meta.story({
parameters: {
a11y: { test: 'todo' },
},
});
import preview from '../.storybook/preview';
import { Button } from './Button';
const meta = preview.meta({
component: Button,
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
});
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary = meta.story({
args: { primary: true },
});
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail = meta.story({
parameters: {
a11y: { test: 'todo' },
},
});
import preview from '../.storybook/preview';
import { Button } from './Button';
const meta = preview.meta({
component: Button,
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
});
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary = meta.story({
args: { primary: true },
});
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail = meta.story({
parameters: {
a11y: { test: 'todo' },
},
});
import preview from '../.storybook/preview';
import Button from './Button.vue';
const meta = preview.meta({
component: Button,
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
});
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary = meta.story({
args: { primary: true },
});
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail = meta.story({
parameters: {
a11y: { test: 'todo' },
},
});
import preview from '../.storybook/preview';
import Button from './Button.vue';
const meta = preview.meta({
component: Button,
parameters: {
// ๐ Applies to all stories in this file
a11y: { test: 'error' },
},
});
// ๐ This story will use the 'error' value and fail on accessibility violations
export const Primary = meta.story({
args: { primary: true },
});
// ๐ This story will not fail on accessibility violations
// (but will still run the tests and show warnings)
export const NoA11yFail = meta.story({
parameters: {
a11y: { test: 'todo' },
},
});