🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

storybook-tailwind-dark-mode

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storybook-tailwind-dark-mode

Toggle stories between light and dark mode using tailwind

1.0.22
latest
Source
npm
Version published
Weekly downloads
4.4K
-11.54%
Maintainers
1
Weekly downloads
 
Created
Source

storybook-tailwind-dark-mode

Example

Installation

Install the following npm module:

npm i --save-dev storybook-tailwind-dark-mode

or with yarn:

yarn add -D storybook-tailwind-dark-mode

Then, add following content to .storybook/main.js

module.exports = {
  addons: ['storybook-tailwind-dark-mode'],
};

Make sure tailwind is configured to use the darkmode class in the tailwind.config.js

module.exports = {
  darkMode: 'class',
  // ...
} 

Set Dark Mode as default

To set dark mode as default, Add the following lines of code to your preview.js file

const preview = {
  globalTypes: {
    darkMode: {
      defaultValue: true, // Enable dark mode by default on all stories
    },
    // Optional (Default: 'dark')
    className: {
      defaultValue: 'custom-classname', // Set your custom dark mode class name
    },
  },
};

Keywords

storybook-addons

FAQs

Package last updated on 16 Apr 2023

Did you know?

Socket

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