Back to integrations
Add your integration
Categories
  • ⭐️ Popular
  • 🧩 Essentials
  • 🛠 Code
  • ⚡️ Data & state
  • ✅ Test
  • 💅 Style
  • 🎨 Design
  • ⚙️ Appearance
  • 🗄 Organize
How to install addons Create an addon
storybook-theme-knob
A Storybook decorator that applies a theme knob to the knobs panel given a list of theme objects each containing an id and an imported css file
npm install storybook-theme-knob
Last updated about 4 years ago
10
Downloads per week
Readme View on GitHub

Storybook Theme Knob

A decorator that, when applied, includes a theme knob as the first knob in the panel for all stories if used globally or for the stories outlined in each story config the decorator is used in.

Usage

The following can be applied globally or in a story config:

addDecorator(withTheme([
    {
        id: 'Theme one',
        code:`<style>${require('!css-loader!../theme1.css')}</style>`,
        default: true
    },
    {
        id: 'Theme two',
        code:`<style>${require('!css-loader!../theme2.css')}</style>`,
        default: false
    },
    {
        id: 'Theme three',
        code:`<style>${require('!css-loader!../theme3.css')}</style>`,
        default: false
    },
]))
Join the community
6,586 developers and counting
WhyWhy StorybookComponent-driven UI
DocsGuidesTutorialsChangelogTelemetryStatus
CommunityAddonsGet involvedBlog
ShowcaseExploreProjectsComponent glossary
Open source software
Storybook

Maintained by
Chromatic
Special thanks to Netlify and CircleCI