Docs
Storybook Docs
You are viewing documentation for a previous version of StorybookSwitch to latest version

docs

Parent: main.js|ts configuration

Type:

{
  autodocs?: boolean | 'tag';
  defaultName?: string;
  docsMode?: boolean;
}

Configures Storybook's auto-generated documentation.

autodocs

Type: boolean | 'tag'

Default: 'tag'

Enables or disables automatic documentation for stories.

  • true: Enables it for all stories
  • false: Disables it for all stories
  • '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

Type: string

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

Type: boolean

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;