storybook-theme-switcher

1.0.0 • Public • Published

Storybook Theme Switcher

code style: prettier

With Storybook Theme Switcher you can easily switch between themes used by Styled Components. If a theme is selected the story's content is wrapped in a Styled Components' ThemeProvider using the selected theme.

Installation

npm install --save-dev storybook-theme-switcher

or

yarn add -D storybook-theme-switcher

Usage

Register the addon in addons.js:

import { registerThemeSwitcher } from  'storybook-theme-switcher'
registerThemeSwitcher()

Configure your themes in config.js or in single stories:

import { withThemeSwitcher } from  'storybook-theme-switcher'
import mainTheme from ...
import darkTheme from ...

addDecorator(withThemeSwitcher({
	themes: {
		'Main Theme':  mainTheme,
		'Dark Theme':  darkTheme
	}
}))

Package Sidebar

Install

npm i storybook-theme-switcher

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

40.3 kB

Total Files

29

Last publish

Collaborators

  • simonljungborg