Storybook Color Theme UI
Storybook Theme UI allows your stories to be displayed in various themes supplied by theme-ui. This addon was made to be primarliy used in conjunction with Storybook Addon Docs but can be used without as well.
Installation
Install the following npm module:
npm i --save-dev storybook-addon-theme-ui theme-ui react
or with yarn:
yarn add -D storybook-addon-theme-ui theme-ui react
Configuration
The color mode addon is configured by story parameters with the themeUi
key. To configure globally, import addParameters
from your app layer in your config.js
file.
;
Options can take a object with the following keys:
themes: ThemeMap[]
An array of objects that include both a reference to your theme object and a name that will be displayed in the theme chooser panel.
Theme Map
withThemeProvider
Like any other storybook decorator just import withThemeProvider
from this package and add it to your
decorator list.
Or done globally in your preview.tsx
addDecoratorwithThemeProvider
Related Projects
This project was built on top of the wonderfully designed Theme UI project.