docs
¥Parent: main.js|ts configuration
类型:
¥Type:
{
autodocs?: boolean | 'tag';
defaultName?: string;
docsMode?: boolean;
}配置 Storybook 的 自动生成的文档。
¥Configures Storybook's auto-generated documentation.
autodocs
类型:boolean | 'tag'
¥Type: boolean | 'tag'
默认:'tag'
¥Default: 'tag'
启用或禁用故事的自动文档生成。
¥Enables or disables automatic documentation for stories.
-
true:对所有故事启用此功能¥
true: Enables it for all stories -
false:对所有故事禁用此功能¥
false: Disables it for all stories -
'tag':对标记为'autodocs'的故事启用此功能¥
'tag': Enables it for stories tagged with'autodocs'
.storybook/main.ts
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
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: {
autodocs: 'tag',
},
};
export default config;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-webpack5, vue3-vite)
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-webpack5, vue3-vite)
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;