提供可配置主題選擇器的 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'
  }
});