Nuanced Pumpkin Mavens

    storybook-addon-emotion-theme
    TypeScript icon, indicating that this package has built-in type declarations

    2.1.1 • Public • Published

    Installation

    yarn add storybook-addon-emotion-theme --dev

    Add to .storybook/addons.js

    import 'storybook-addon-emotion-theme/dist/register';

    addDecorator to .storybook/config.js

    import { addDecorator } from '@storybook/react';
    import { withThemesProvider } from 'storybook-addon-emotion-theme';
     
    const themes = [theme1, theme2];
    addDecorator(withThemesProvider(themes));

    or

    addDecorator to stories

    import {withThemesProvider} from 'storybook-addon-emotion-theme';
     
    const themes = [theme1, theme2];
     
    storiesOf("demo", module)
      .addDecorator(withThemesProvider(themes))
      .add("demo div", () => <div>DEMO</div>);

    Reminder

    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.

    Contributing

    yarn

    yarn build

    yarn example

    Thanks

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

    Install

    npm i storybook-addon-emotion-theme

    DownloadsWeekly Downloads

    1,144

    Version

    2.1.1

    License

    MIT

    Unpacked Size

    17 kB

    Total Files

    22

    Last publish

    Collaborators

    • patrickgordon