加入直播会话:周四,美国东部时间上午11点,Storybook 9发布与AMA

Tailwind Dark

一个用于切换 Tailwind 暗黑模式(选择器)的插件

在 Github 上查看

Storybook Addon Tailwind Dark

一个用于在 Storybook v8 中切换 Tailwind 暗黑主题的插件

安装

首先,安装软件包。

npm install --save-dev storybook-addon-tailwind-dark

然后,在 .storybook/main.js 中将其注册为插件。

// .storybook/main.ts

// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
import type { StorybookConfig } from '@storybook/react';

const config: StorybookConfig = {
  // ...rest of config
  addons: [
    '@storybook/addon-essentials',
    'storybook-addon-tailwind-dark', // 👈 register the addon here
  ],
};

export default config;