First, install the addon
npm install -D storybook-addon-themr
Add this line to your addons.js
file (create this file inside your storybook config directory if needed).
import 'storybook-addon-themr/register';
Now add your themes to stories
import React from 'react';
import { storiesOf, addDecorator } from '@storybook/react';
import { reactCSSThemr } from 'storybook-addon-themr';
const themes = {
'theme no. 1': {...theme1},
'theme no. 2': {...theme2}
};
storiesOf('Story', module)
.addDecorator(reactCSSThemr(themes))
.add('components', () => (
<Components />
));