For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/framework/react.md.
close

React

Storybook for React & Rsbuild lets you develop and test React components in isolation using the Rsbuild toolchain your app already relies on.

Requirements

PackageVersion
react≥ 18
@rsbuild/core^2.0.0
storybook^11.0.0-rc.1

Getting started

Follow these steps inside an existing Rsbuild-powered React project.

Installation

Install the framework package and @rsbuild/core. Even though storybook-react-rsbuild declares @rsbuild/core as a peer, list it as a direct dev dependency so version pins and lockfile audits remain unambiguous.

npm
yarn
pnpm
bun
deno
npm install @rsbuild/core storybook-react-rsbuild -D

Configure .storybook/main.ts

import { StorybookConfig } from 'storybook-react-rsbuild'
import { mergeRsbuildConfig } from '@rsbuild/core'

const config: StorybookConfig = {
  framework: 'storybook-react-rsbuild',
  stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
  rsbuildFinal: (config) => {
    // Customize the final Rsbuild config here
    return mergeRsbuildConfig(config, {
      // your custom config
    })
  },
}

export default config

That's it! Explore the React 18 sandbox for a full example, and continue learning from the Storybook documentation.

Next Steps

Now that you've set up the build system, learn how to write stories and document your components:

  • Writing Stories: Learn the basics of Component Story Format (CSF).
  • Auto-docs: Automatically generate documentation from your components.

Options

Please refer to the Configuration Guide for framework-specific options and defaults.