yarn add storybook-addon-react-context --dev
import 'storybook-addon-react-context/dist/register';
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.
yarn
yarn build
yarn example
Thanks to Carlos for making storybook-addon-styled-component-theme and upon which this library was based on top of.