加入直播:美东时间周四上午11点,Storybook 9 发布及问答会
文档
Storybook Docs

框架

(必需)

父级:main.js|ts 配置

类型:FrameworkName | { name: FrameworkName; options?: FrameworkOptions }

根据一套框架特定的设置配置 Storybook。

.storybook/main.ts
// Replace your-framework with the framework you are using, e.g. react-vite, nextjs, nextjs-vite, etc.
import type { StorybookConfig } from '@storybook/your-framework';
 
const config: StorybookConfig = {
  framework: {
    name: '@storybook/your-framework',
    options: {
      legacyRootApi: true,
    },
  },
  stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
};
 
export default config;

name

类型:string

有关可用的框架及其选项,请参阅其各自的文档

options

类型:Record<string, any>

虽然许多选项是框架特定的,但也有一些选项是在某些框架之间共享的,例如配置 Storybook 构建器的选项。

options.builder

类型:Record<string, any>

配置 Storybook 的构建器,ViteWebpack