文档
Storybook Docs

tags

父级:main.js|ts 配置

类型: { [tagName: string]: { defaultFilterSelection?: 'include' | 'exclude' } }

定义自定义 标签,或更改内置标签的默认配置。

.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)'],
  tags: {
    // 👇 Define a custom tag named "experimental"
    experimental: {
      defaultFilterSelection: 'exclude', // Or 'include'
    },
  },
};
 
export default config;

[tagName]

类型:string

标签的名称。这可以是任何静态(即非动态创建)的字符串,可以是内置标签,也可以是您自己设计的自定义标签。

[tagName].defaultFilterSelection

类型: 'include' | 'exclude'

设置 Storybook 侧边栏中标签的默认筛选选择状态。如果设置为 include,则带有此标签的故事将被选中为包含。如果设置为 exclude,则带有此标签的故事将被选中为排除,并且必须通过在侧边栏筛选菜单中选择该标签来显式包含。如果未设置,则该标签没有默认选择。

Filtering by tags