Back to Storybook

Storybook Preview Docs Dark Theme

docs/_snippets/storybook-preview-docs-dark-theme.md

10.3.63.6 KB
Original Source
js
import { themes } from 'storybook/theming';

export default {
  parameters: {
    docs: {
      theme: themes.dark,
    },
  },
};
ts
// Replace your-framework with the framework you are using, e.g. react-vite, nextjs, vue3-vite, etc.
import type { Preview } from '@storybook/your-framework';

import { themes } from 'storybook/theming';

const preview: Preview = {
  parameters: {
    docs: {
      theme: themes.dark,
    },
  },
};

export default preview;
ts
// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite)
import { definePreview } from '@storybook/your-framework';
import addonDocs from '@storybook/addon-docs';

import { themes } from 'storybook/theming';

export default definePreview({
  addons: [addonDocs()],
  parameters: {
    docs: {
      theme: themes.dark,
    },
  },
});
<!-- JS snippets still needed while providing both CSF 3 & Next -->
js
// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite)
import { definePreview } from '@storybook/your-framework';
import addonDocs from '@storybook/addon-docs';

import { themes } from 'storybook/theming';

export default definePreview({
  addons: [addonDocs()],
  parameters: {
    docs: {
      theme: themes.dark,
    },
  },
});
ts
import { definePreview } from '@storybook/vue3-vite';
import addonDocs from '@storybook/addon-docs';

import { themes } from 'storybook/theming';

export default definePreview({
  addons: [addonDocs()],
  parameters: {
    docs: {
      theme: themes.dark,
    },
  },
});
<!-- JS snippets still needed while providing both CSF 3 & Next -->
js
import { definePreview } from '@storybook/vue3-vite';
import addonDocs from '@storybook/addon-docs';

import { themes } from 'storybook/theming';

export default definePreview({
  addons: [addonDocs()],
  parameters: {
    docs: {
      theme: themes.dark,
    },
  },
});
ts
import { definePreview } from '@storybook/angular';
import addonDocs from '@storybook/addon-docs';

import { themes } from 'storybook/theming';

export default definePreview({
  addons: [addonDocs()],
  parameters: {
    docs: {
      theme: themes.dark,
    },
  },
});
ts
import { definePreview } from '@storybook/web-components-vite';
import addonDocs from '@storybook/addon-docs';

import { themes } from 'storybook/theming';

export default definePreview({
  addons: [addonDocs()],
  parameters: {
    docs: {
      theme: themes.dark,
    },
  },
});
<!-- JS snippets still needed while providing both CSF 3 & Next -->
js
import { definePreview } from '@storybook/web-components-vite';
import addonDocs from '@storybook/addon-docs';

import { themes } from 'storybook/theming';

export default definePreview({
  addons: [addonDocs()],
  parameters: {
    docs: {
      theme: themes.dark,
    },
  },
});