Docs
Storybook Docs

docs

父级:main.js|ts 配置

¥Parent: main.js|ts configuration

类型:

¥Type:

{
  defaultName?: string;
  docsMode?: boolean;
}

配置 Storybook 的 自动生成的文档

¥Configures Storybook's auto-generated documentation.

defaultName

类型:string

¥Type: string

默认:'Docs'

¥Default: 'Docs'

用于生成的文档页面的名称。

¥Name used for generated documentation pages.

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

docsMode

类型:boolean

¥Type: boolean

仅在侧边栏中显示文档页面(通常使用 --docs CLI 标志设置)。

¥Only show documentation pages in the sidebar (usually set with the --docs CLI flag).

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