@stevendejong/storybook-stylesheet-toggle

0.0.12 • Public • Published

Storybook Stylesheet Toggle addon

The Storybook Stylesheet Toggle addon is a simple and convenient tool for changing stylesheets on the fly within your Storybook stories. It allows you to dynamically switch between different stylesheets using a dropdown menu accessed via a toolbar button.

Usage

Setting Stylesheets

You can specify the stylesheets you want to toggle in your story using the stylesheetToggle parameter. This parameter should be an object where each key represents a label for the stylesheet option, and the corresponding value is the path to the stylesheet file or a URL:

import type { Preview } from "@storybook/react";

const preview: Preview = {
  parameters: {
    ...
    stylesheetToggle: {
      "default": "main.css",
      "custom-theme": "custom-theme.css",
      "second-custom-theme": "https://second.com/custom-theme.css",
    },
    ...
  },
};

export default preview;

Using the Toggle

Once you've configured your story, you'll see a toolbar button in Storybook that allows you to select and apply different stylesheets to your components during development.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.12187latest
0.0.12--canary.403e0aa.01canary

Version History

VersionDownloads (Last 7 Days)Published
0.0.12187
0.0.12--canary.403e0aa.01
0.0.110
0.0.11--canary.10.403e0aa.01
0.0.100
0.0.10--canary.9.d78700e.00
0.0.90
0.0.9--canary.8.521e682.00
0.0.832
0.0.70
0.0.7--canary.6.fe0fb81.00
0.0.60
0.0.6--canary.5.97bab5d.00
0.0.50
0.0.5--canary.4.7fe10e1.00
0.0.40
0.0.4--canary.3.72cc709.00
0.0.30
0.0.20
0.0.2--canary.1.faae223.00
0.0.11
0.0.00

Package Sidebar

Install

npm i @stevendejong/storybook-stylesheet-toggle

Weekly Downloads

222

Version

0.0.12

License

MIT

Unpacked Size

16.3 kB

Total Files

18

Last publish

Collaborators

  • stevendejong