storybook 插件,提供可配置的主题选择器

在 Github 上查看

Storybook 主题插件

注意

仅支持 storybook 5.x 及更高版本。

安装

npm i @inki/storybook-addon-theme --dev

添加到 .storybook/addons.js

import '@inki/storybook-addon-theme/register';

用法

.storybook/config.js


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

const themes = [
    {
      label: "Chalk",
      value: 'chalk'
    },
    {
      label: "Dark",
      value: "dark"
    }
];

addParameters({ 
  themes: {
    items: themes,
    // optional: set the initial active theme
    active: themes[0].value,
    // optional: set the icon used in the toolbar
    icon: 'document'
  }
});