This package is no longer being maintained and has stopped active development.
yarn add storybook-addon-emotion-theme --dev
import 'storybook-addon-emotion-theme/dist/register';
import { addDecorator } from '@storybook/react';
import { withThemesProvider } from 'storybook-addon-emotion-theme';
const themes = [theme1, theme2];
addDecorator(withThemesProvider(themes));
or
import {withThemesProvider} from 'storybook-addon-emotion-theme';
const themes = [theme1, theme2];
storiesOf("demo", module)
.addDecorator(withThemesProvider(themes))
.add("demo div", () => <div>DEMO</div>);
Make sure every theme has a name
property. For example:
const myTheme = {
name: "Light",
primaryColor: "blue"
}
This is used for displaying in the Storybook UI.
yarn
yarn build
yarn example
Thanks to Carlos for making storybook-addon-styled-component-theme upon which this library was based on top of.