Use your theme-provider on your favourite storybook
The Storybook SC ThemeProvider is an addon that allows users to display a Styled-Components ThemeProvider or a custom one in their Storybook. It works on both Storybook 5.x.x and 6.x.x versions and offers features such as switching background colors, compatibility with iframes or visual regression testing, and the ability to pass a custom implementation of a theme provider. The addon also includes a popup displaying all the current keys of the theme, which can be disabled if desired.
To install the Storybook SC ThemeProvider addon, follow these steps:
addons: [
// other addons...
'storybook-sc-theme-provider',
],
withThemesProvider function in your preview.js file.import { withThemesProvider } from 'storybook-sc-theme-provider';
export const decorators = [
withThemesProvider(),
// other decorators...
];
The Storybook SC ThemeProvider is a helpful addon for displaying Styled-Components ThemeProviders or custom ones in Storybook. It offers various features such as switching background colors, compatibility with iframes and visual regression testing, and the ability to pass a custom implementation of a theme provider. The addon also includes a popup displaying all the current keys of the theme, with the option to disable it if desired. Installation is straightforward and can be done by adding a line to the addons array in the main.js file and setting options globally in the preview.js file.