The StorybookConfig interface defines the configuration options for your Storybook React Native setup. This is typically exported from .storybook/main.ts or .storybook/main.js.
Interface Definition
interface StorybookConfig {
stories : StorybookConfigBase [ 'stories' ];
addons : Array < string | { name : string ; options ?: Record < string , any > }>;
reactNative ?: ReactNativeOptions ;
features ?: Features ;
framework ?: '@storybook/react-native' ;
}
Properties
stories
string[] | StoriesSpecifier[]
required
Array of glob patterns or story specifiers that define where your story files are located. stories : [
'../components/**/*.stories.?(ts|tsx|js|jsx)' ,
'../other_components/**/*.stories.?(ts|tsx|js|jsx)'
]
addons
Array<string | { name: string; options?: Record<string, any> }>
required
List of Storybook addons to enable. Can be addon package names or objects with name and options. addons : [
'@storybook/addon-ondevice-controls' ,
'@storybook/addon-ondevice-actions' ,
{
name: '@storybook/addon-ondevice-backgrounds' ,
options: {
values: [
{ name: 'light' , value: '#F8F8F8' },
{ name: 'dark' , value: '#333333' }
]
}
}
]
React Native-specific configuration options. Enable play function support. Note that play functions are not yet fully supported on native. Default: false
Feature flags to enable experimental or optional features. Enable the built-in on-device backgrounds addon panel. Default: false
framework
'@storybook/react-native'
Specifies the Storybook framework being used. Should be set to '@storybook/react-native'.
Complete Example
import type { StorybookConfig } from '@storybook/react-native' ;
const config : StorybookConfig = {
stories: [
'../components/**/*.stories.?(ts|tsx|js|jsx)' ,
],
addons: [
'@storybook/addon-ondevice-controls' ,
'@storybook/addon-ondevice-actions' ,
'@storybook/addon-ondevice-backgrounds' ,
'@storybook/addon-ondevice-notes' ,
],
framework: '@storybook/react-native' ,
features: {
ondeviceBackgrounds: true ,
},
reactNative: {
playFn: false ,
},
};
export default config ;
ReactNativeOptions
interface ReactNativeOptions {
/**
* Note that this is for future and play functions are not yet fully supported on native.
*/
playFn ?: boolean ;
}
Features
interface Features {
/** Enable the built-in on-device backgrounds addon panel. */
ondeviceBackgrounds ?: boolean ;
}
See Also