storybook-darkmode-vue
Storybook addons supporting darkmode in vue app
npm install storybook-darkmode-vue
74
Downloads per week

Storybook Darkmode in Vue ๐ŸŒ™

version MIT License PRs Welcome downloads Examples

โž• Install

npm i storybook-darkmode-vue -D
yarn add storybook-darkmode-vue -D

๐ŸŽ‰ Objective

Develop Vue application that provides darkmode with Storybook.

๐Ÿ’ป Preview

Light Mode Dark Mode
LightModeImage DarkModeImage

๐Ÿšง Usage

Use either already made up DarkModeWrapper,

// stories
import { storiesOf } from '@storybook/vue';
import DarkModeWrapper from 'storybook-darkmode-vue/DarkModeWrapper';
import DarkModeSample from './DarkModeSample';

storiesOf('Sample', module).add('sample1', () => ({
  data: () => ({}),
  components: {
    DarkModeWrapper,
    DarkModeSample,
  },
  methods: {},
  template: `
    <div>
      <DarkModeWrapper v-slot="{isDarkMode}">
        <DarkModeSample :is-dark-mode="isDarkMode"/>
      </DarkModeWrapper>
    </div>
  `,
}));

OR personally make Wrapper.

import { addons } from '@storybook/addons'

const channel = addons.getChanel();

channel.on('STORYBOOK_DARK_MODE_VUE, () => {
    // ... 
});

channel.off('STORYBOOK_DARK_MODE_VUE', () => {
    // ...
});

๐Ÿ”ง Configuration

Need to register as following:

// addons.js
import 'storybook-darkmode-vue/register'

๐Ÿ™‡ Contribution

See CONTRIBUTING.md.