Skip to content

kyanmichael/storybook-addon-styled-component-theme

 
 

Repository files navigation

npm version build status codecov

Notice

Only support storybook 4 and newer

Installation

yarn add storybook-addon-styled-component-theme --dev

Add to .storybook/addons.js

import 'storybook-addon-styled-component-theme/dist/src/register'; // v1.1.0^

import 'storybook-addon-styled-component-theme/dist/register'; // v1.0.7

addDecorator to .storybook/config.js

import {addDecorator} from '@storybook/react';
import {withThemesProvider} from 'storybook-addon-styled-component-theme';

const themes = [theme1, theme2];
addDecorator(withThemesProvider(themes));

or

addDecorator to stories

import {withThemesProvider} from 'storybook-addon-styled-component-theme';

const themes = [theme1, theme2];

storiesOf("demo", module)
  .addDecorator(withThemesProvider(themes))
  .add("demo div", () => <div>DEMO</div>);

Remind

Make sure every theme object has a name property

Contributing

yarn

yarn build:watch

yarn serve

About

storybook addon

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 91.9%
  • JavaScript 8.1%