📓 Storybook for React Native!
Storybook for React Native
A new docs site is being built for Storybook for React Native, you can find it at https://storybookjs.github.io/react-native/docs/intro/.
[!IMPORTANT] This readme is for v10, for v9 docs see the v9.1 docs.
With Storybook for React Native you can design and develop individual React Native components without running your app.
If you are migrating from 9 to 10 you can find the migration guide here
For more information about storybook visit: storybook.js.org
[!NOTE] Make sure you align your storybook dependencies to the same major version or you will see broken behaviour. Table of contents
There is some project boilerplate with @storybook/react-native and @storybook/addon-react-native-web both already configured with a simple example.
For Expo you can use this template with the following command
For React Native CLI you can use this template Existing project
Run init to setup your project with all the dependencies and configuration files:
Then wrap your bundler config with the withStorybook function. It auto-detects Metro vs Re.Pack and handles everything — entry-point swapping, story generation, and optional WebSocket setup.
No changes to App.tsx are needed. Set STORYBOOK_ENABLED=true and run:
The wrapper automatically swaps your app's entry point with Storybook's entry point. When the variable is not set, your app runs normally with zero Storybook code in the bundle.
If you want to add everything yourself check out the manual setup guide. Reanimated setup
Make sure you have react-native-reanimated in your project and the plugin setup in your babel config.
Re.Pack setup
For projects using Re.Pack (Rspack/Webpack) instead of Metro, see the full Re.Pack Setup guide. You can also reference the RepackStorybookStarter project. Expo router specific setup
For Expo Router projects, you can either use entry-point swapping (recommended) or create a dedicated Storybook route.
See the full Expo Router Setup guide for details. Writing stories
In Storybook we use a syntax called CSF that looks like this:
You should configure the path to your story files in the main.ts config file from the .rnstorybook folder.
Decorators and Parameters
For stories you can add decorators and parameters on the default export or on a specific story.
For global decorators and parameters, you can add them to preview.tsx inside your .rnstorybook folder.
Addons
The cli will install some basic addons for you such as controls and actions. Ondevice addons are addons that can render with the device ui that you see on the phone.
Currently, the addons available are:
@storybook/addon-ondevice-controls: adjust your components props in realtime@storybook/addon-ondevice-actions: mock onPress calls with actions that will log information in the actions tab@storybook/addon-ondevice-notes: Add some Markdown to your stories to help document their usage@storybook/addon-ondevice-backgrounds: change the background of storybook to compare the look of your component against different backgroundsInstall each one you want to use and add them to the deviceAddons list in your main.ts:
[!NOTE]
deviceAddonsensures on-device addons are only loaded at runtime on the device, avoiding errors during server-side operations. For backwards compatibility, listing them inaddonsstill works. Using the addons in your story
For details of each ondevice addon you can see the readme:
Starting with v10.4, entry-point swapping is the default setup. Your existing in-app integration setup continues to work and is fully supported, but entry-point swapping is the recommended approach for new projects. Entry-point swapping (recommended, v10.4+)
When using the bundler-agnostic withStorybook wrapper, set STORYBOOK_ENABLED=true to run Storybook. The wrapper swaps your app's entry point with Storybook's entry point automatically. When the variable is not set, your app runs normally with zero Storybook code in the bundle.
Expo Router
Create a dedicated route for Storybook:
Then navigate to /storybook in your app to view stories.
In-app integrat
On-device Controls stop working after Fast Refresh: "cannot render when canvasElement is unset"
[Feature Request] Close Bottom Sheet When Story is Selected
Importing from `@storybook/react-native` pollutes the React Native TypeScript environment with Node.js types
Automated "All stories" story
Story tags
Create global control shared by all stories
react-native autodocs support
Add 'check' option in @storybook/addon-ondevice-controls
asyncstorage on web: error reading from async storage ReferenceError: window is not defined
Support story play function