Socket
Socket
Sign inDemoInstall

storybook-stylesheet-toggle

Package Overview
Dependencies
58
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    storybook-stylesheet-toggle

A Storybook addon for toggling between stylesheets.


Version published
Weekly downloads
1.6K
increased by2.21%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Storybook Stylesheet Toggle

A simple addon for Storybook that allows you to define a set of stylesheets that can be toggled between. This may be useful if your project has multiple themes, or if you want to stress test your components in different styling environments.

Getting started

yarn add -D storybook-stylesheet-toggle

Install the addon in .storybook/main.js:

module.exports = {
  addons: ["storybook-stylesheet-toggle"],
};

Add the following configuration to .storybook/preview.js:

import { addParameters } from '@storybook/react';

addParameters({
  stylesheetToggle: {
    stylesheets: [
      {
        id: 'first',
        title: 'First stylesheet',
        url: 'path/to/first-sheet.css',
      },
      {
        id: 'second',
        title: 'Second stylesheet',
        url: 'path/to/second-sheet.css',
      },
    ],
  },
});

Ensure the path to your stylesheets is being served by Storybook (with the -s ./path parameter.)

Boot Storybook, and you should now see a paintbrush menu, allowing you to toggle between the stylesheets you've configured. The first stylesheet will be applied by default.

Keywords

FAQs

Last updated on 14 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc