Parent: main.js|ts configuration
Type:
{ [ key : string ] :
| { title : string ; url : string ; expanded ?: boolean , sourceUrl ?: string }
| ( config : { title : string ; url : string ; expanded ? : boolean , sourceUrl : string }) => { title : string ; url : string ; expanded ?: boolean , sourceUrl ?: string }
| { disable : boolean }
}
Configures Storybook composition .
// 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)' ] ,
refs : {
'design-system' : {
title : 'Storybook Design System' ,
url : 'https://master--5ccbc373887ca40020446347.chromatic.com/' ,
expanded : false , // Optional, true by default,
sourceUrl : 'https://github.com/storybookjs/storybook' , // Optional
} ,
} ,
} ;
export default config ;
You can use a function to dynamically configure refs:
// 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)' ] ,
// ๐ Retrieve the current environment from the configType argument
refs : ( config , { configType } ) => {
if ( configType === 'DEVELOPMENT' ) {
return {
react : {
title : 'Composed React Storybook running in development mode' ,
url : 'http://localhost:7007' ,
} ,
angular : {
title : 'Composed Angular Storybook running in development mode' ,
url : 'http://localhost:7008' ,
} ,
} ;
}
return {
react : {
title : 'Composed React Storybook running in production' ,
url : 'https://your-production-react-storybook-url' ,
} ,
angular : {
title : 'Composed Angular Storybook running in production' ,
url : 'https://your-production-angular-storybook-url' ,
} ,
} ;
} ,
} ;
export default config ;
Some package dependencies automatically compose their Storybook in yours . You can disable this behavior by setting disable
to true
for the package name:
// 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)' ] ,
refs : {
'package-name' : { disable : true } ,
} ,
} ;
export default config ;