storybook-addon-styled-components-themes
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Storybook/Addon: styled-components with themes

Storybook addon for styled components with theme provider

Getting Started

Installing

yarn add storybook-addon-styled-components-themes --D

Configuration

Register the addon in .storybook/main.js

module.exports = {
  stories: ['../src/**/*.stories.(tsx|mdx)'],
  addons: ['storybook-addon-styled-components-themes/register']
};

Add parameters to stories in .storybook/preview.js

addParameters({
  styledComponentsThemes: {
    /**
     * Themes
     */
    themes: [ThemeA, ThemeB],
    /**
     * Theme to start on - index - optional
     */
    initialTheme: 1, // optional
    /**
     *  Key for show name of theme - optional
     */
    label: 'name', // optional
  },
});

Add decorator to stories in .storybook/preview.js

addDecorator(story => (
    <WithThemeProvider>
        {story()}
    </WithThemeProvider>
));

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    512
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    512
  • 0.0.1
    0

Package Sidebar

Install

npm i storybook-addon-styled-components-themes

Weekly Downloads

512

Version

0.0.2

License

MIT

Unpacked Size

10.8 kB

Total Files

14

Last publish

Collaborators

  • elsa-santos