Docs
Storybook Docs

tags

Parent: main.js|ts configuration

Type: { [tagName: string]: { defaultFilterSelection?: 'include' | 'exclude', hideFromSidebar?: boolean, hideFromAutodocs?: boolean, hideFromFilterPanel?: boolean } }

Define custom tags for your stories, or alter the default configuration of built-in tags.

.storybook/main.ts
// 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)'],
  tags: {
    // ๐Ÿ‘‡ Define a custom tag named "experimental"
    experimental: {
      defaultFilterSelection: 'exclude', // Or 'include'
    },
  },
});

[tagName]

Type: string

The name of the tag. This can be any static (i.e. not created dynamically) string, either a built-in tag or a custom tag of your own design.

[tagName].defaultFilterSelection

Type: 'include' | 'exclude'

Set the default filter selection state for a tag in the Storybook sidebar. If set to include, stories with this tag are selected as included. If set to exclude, stories with this tag are selected as excluded, and must be explicitly included by selecting the tag in the sidebar filter menu. If not set, the tag has no default selection.

[tagName].hideFromSidebar

Type: boolean

Remove stories with this tag from the sidebar. The filter menu cannot bring them back. This is stronger than defaultFilterSelection: 'exclude', which the user can clear.

[tagName].hideFromAutodocs

Type: boolean

Remove stories with this tag from autodocs pages.

[tagName].hideFromFilterPanel

Type: boolean

Hide this tag from the sidebar filter menu. Stories with the tag stay visible unless hideFromSidebar or hideFromAutodocs also applies.

A hidden tag can still be an active filter when defaultFilterSelection or the URL selects it. The menu then shows an active-filter count and no checkbox for that tag. Do not combine hideFromFilterPanel with a default or URL selection for the same tag.

Filtering by tags