storybook/docs/snippets/vue/storybook-addon-a11y-story-config.ts.mdx
2023-01-06 19:15:31 +00:00

54 lines
1.4 KiB
Plaintext

```js
// MyComponent.stories.ts
// For Vue 3 use import type { Meta, StoryObj } from '@storybook/vue3';
import type { Meta, StoryObj } from '@storybook/vue';
import MyComponent from './MyComponent.vue';
const meta: Meta<typeof MyComponent> = {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/7.0/vue/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Configure a11y addon',
component: MyComponent,
};
export default meta;
type Story = StoryObj<typeof MyComponent>;
/*
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
* See https://storybook.js.org/docs/7.0/vue/api/csf
* to learn how to use render functions.
*/
export const ExampleStory = {
render: () => ({
components: { MyComponent },
template: '<MyComponent/>',
}),
parameters: {
a11y: {
element: '#storybook-root',
config: {
rules: [
{
// The autocomplete rule will not run based on the CSS selector provided
id: 'autocomplete-valid',
selector: '*:not([autocomplete="nope"])',
},
{
// Setting the enabled option to false will disable checks for this particular rule on all stories.
id: 'image-alt',
enabled: false,
},
],
},
options: {},
manual: true,
},
},
};
```