Skip to content

ntnbrtnkv/storybook-addon-react-context

Repository files navigation

React Context Addon

npm version npm CircleCI David Snyk Vulnerabilities for GitHub Repo


Installation

yarn add storybook-addon-react-context --dev

Add to .storybook/addons.js

import 'storybook-addon-react-context/dist/register';

addDecorator to .storybook/config.js

import { addDecorator } from '@storybook/react';
import { withContextProvider } from 'storybook-addon-react-context';

import { ReactContextProvider } from './path/to/file';

addDecorator(withContextProvider({
  provider: ReactContextProvider,
  options: [
    {
      value: '1',
      label: 'one'
    },
    {
      value: '2',
      label: 'two'
    }
  ]
}));

This is used for displaying in the Storybook UI.

Contributing

yarn

yarn build

yarn example

Thanks

Thanks to Carlos for making storybook-addon-styled-component-theme and upon which this library was based on top of.