fbredius/storybook

View on GitHub
docs/snippets/common/storybook-addon-a11y-component-config.mdx.mdx

Summary

Maintainability
Test Coverage
```md
<!-- MyComponent.stories.mdx -->

import { Meta } from '@storybook/addon-docs';

import { MyComponent } from './MyComponent';

<Meta
  title="Configure a11y addon"
  component={MyComponent}
  parameters={{
    a11y: {
      // Optional selector to inspect
      element: '#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,
    },
  }} />
```