3.4.3 • Published 6 years ago

@nlabs/storybook-addon-a11y v3.4.3

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

storybook-addon-a11y

This storybook addon can be helpfull to make your UI components more accessibile.

npm.io

Getting started

First, install the addon.

$ npm install -D @nlabs/storybook-addon-a11y

Add this line to your addons.js file (create this file inside your storybook config directory if needed).

import '@nlabs/storybook-addon-a11y/register';

import the 'checkA11y' decorator to check your stories for violations within your components.

import React from 'react';
import { storiesOf } from '@nlabs/storybook-react';

import { checkA11y } from '@nlabs/storybook-addon-a11y';

storiesOf('button', module)
  .addDecorator(checkA11y)
  .add('Accessible', () => (
    <button>
      Accessible button
    </button>
  ))
  .add('Inaccessible', () => (
    <button style={{ backgroundColor: 'red', color: 'darkRed', }}>
      Inaccessible button
    </button>
  ));

Roadmap

  • Make UI accessibile
  • Add color blindness filters (Example)
  • Show in story where violations are.
  • Make it configurable
  • Add more example tests
  • Add tests
  • Make CI integration possible