features
¥Parent: main.js|ts configuration
类型:
¥Type:
{
actions?: boolean;
argTypeTargetsV7?: boolean;
backgrounds?: boolean;
controls?: boolean;
developmentModeForBuild?: boolean;
experimentalTestSyntax?: boolean;
highlight?: boolean;
interactions?: boolean;
legacyDecoratorFileOrder?: boolean;
measure?: boolean;
outline?: boolean;
toolbars?: boolean;
viewport?: boolean;
}启用 Storybook 的附加功能。
¥Enables Storybook's additional features.
actions
类型:boolean
¥Type: boolean
启用 操作 功能。
¥Enable the Actions feature.
argTypeTargetsV7
(⚠️实验性)
¥(⚠️ Experimental)
类型:boolean
¥Type: boolean
使用来自渲染函数的类型上的 "target" 过滤参数。
¥Filter args with a "target" on the type from the render function.
// 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)'],
features: {
argTypeTargetsV7: true,
},
};
export default config;backgrounds
类型:boolean
¥Type: boolean
启用 背景 功能。
¥Enable the Backgrounds feature.
controls
类型:boolean
¥Type: boolean
启用 控件 功能。
¥Enable the Controls feature.
developmentModeForBuild
类型:boolean
¥Type: boolean
在内置的故事书中将 NODE_ENV 设置为 'development',以获得更好的测试和调试功能。
¥Set NODE_ENV to 'development' in built Storybooks for better testing and debugging capabilities.
// 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)'],
features: {
developmentModeForBuild: true,
},
};
export default config;experimentalTestSyntax
(⚠️实验性)
¥(⚠️ Experimental)
类型:boolean
¥Type: boolean
启用 使用 CSF Next 格式的实验性 .test 方法。
¥Enable the experimental .test method with the CSF Next format.
// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite)
import { defineMain } from '@storybook/your-framework/node';
export default defineMain({
framework: '@storybook/your-framework',
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
features: {
experimentalTestSyntax: true,
},
});highlight
类型:boolean
¥Type: boolean
启用 高亮 功能。
¥Enable the Highlight feature.
interactions
类型:boolean
¥Type: boolean
启用 交互 功能。
¥Enable the Interactions feature.
legacyDecoratorFileOrder
类型:boolean
¥Type: boolean
在插件或框架的装饰器之前应用来自 preview.js 的装饰器。更多信息。
¥Apply decorators from preview.js before decorators from addons or frameworks. More information.
// 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)'],
features: {
legacyDecoratorFileOrder: true,
},
};
export default config;measure
类型:boolean
¥Type: boolean
启用 测量 功能。
¥Enable the Measure feature.
outline
类型:boolean
¥Type: boolean
启用 大纲 功能。
¥Enable the Outline feature.
toolbars
类型:boolean
¥Type: boolean
启用 工具栏 功能。
¥Enable the Toolbars feature.
viewport
类型:boolean
¥Type: boolean
启用 视口 功能。
¥Enable the Viewport feature.
