Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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
  • Socket score

Version published
Weekly downloads
4.8K
increased by10.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

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc