Skip to main content
← Guides

Guide

Upgrading Storybook 10 to 11 with npm, React and Vite

Updated PkgPulse Team5 min read
0

Use this Storybook migration for React and Vite to check your runtime, update Docs configuration, and verify stories and browser interactions before release.

Contents

Upgrade from Storybook 10.6.10 to 11.0.2 on React and Vite by moving the framework and addons together and keeping the existing CSF story format. First check that the same story opens, responds to a click, and still has its Docs page. In the test project, both versions built successfully, but the subtitle disappeared on Storybook 11 until the story moved it to parameters.docs.subtitle.

Capture a baseline before changing dependencies

Start from a passing Storybook 10 build. If you are on an earlier major, finish the upgrade to Storybook 10 first. The Storybook 11 upgrader includes automigrations for the move from Storybook 10. Choose a story that uses your preview configuration, and record its URL, an expected change after user input, and a visible result from any addon your team relies on. Save the lockfile and last good static build so the new build can be checked against the same evidence. Storybook migration guide

Check the prerequisites in development, CI, and any service that builds your static Storybook. For React and Vite, Storybook documents minimum versions of Node.js 22.12, Vite 6.3, React 18, and TypeScript 5.9. The React framework declares TypeScript as a peer even for JavaScript projects because the default server-side docgen uses it. Use the React Vite package manifest to check the exact peer ranges and the versioned migration notes for docgen caveats and the supported manager browsers.

Keep the existing major pinned if your CI image, required addon, or browser environment cannot meet the upgrade requirements. Resolve that blocker and prove the baseline still works before changing the Storybook packages. If you can keep your React and Vite versions, do so for the first pass. It makes a missing story or prop easier to trace to the Storybook change.

Upgrade the framework and Docs addon together

Run the official upgrader in a clean branch from your repository root. It finds Storybook projects, updates their packages and checks project health. If your repo has several Storybooks, review the output for each workspace. Check third-party addon peer ranges before starting. For the npm fixture, this command resolved the CLI, framework and Docs addon to the same release and ran the subtitle automigration. Storybook upgrade workflow

The fixture starts with the React Vite framework, Docs addon and a compatible TypeScript dependency. It uses the following command and the existing build script.

npx --yes storybook@11.0.2 upgrade --yes --package-manager npm
npm run build-storybook

The build script runs storybook build. Review the manifest, lockfile and story diff the upgrader leaves behind, including any agent setup files it adds. A direct install over the fixture's old lockfile hit npm's ERESOLVE. The official upgrader completed and the resulting lockfile passed a clean npm ci. This .storybook/main.ts worked on both package sets. The story glob points at the same files on both sides, and @storybook/addon-docs stays registered.

import type { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
  framework: '@storybook/react-vite',
  stories: ['../src/**/*.stories.tsx'],
  addons: ['@storybook/addon-docs'],
};

export default config;

Verify the story in Canvas and Docs

The test component in src/Toggle.tsx exposes its state through aria-pressed. The browser check reads that attribute before and after a click on the button named “Toggle alerts”.

import { useState } from 'react';

export function Toggle({ label }: { label: string }) {
  const [pressed, setPressed] = useState(false);

  return (
    <button aria-pressed={pressed} onClick={() => setPressed(!pressed)}>
      {label}
    </button>
  );
}

In src/Toggle.stories.tsx, the original component metadata used parameters: { componentSubtitle: 'Toggle button states' }. The component-subtitle automigration changed that line to the nested docs.subtitle form below. The story's title, export, args and autodocs tag stayed in place, so the Canvas and Docs URLs could be compared directly. If your parameters are assembled with spreads, check the migration summary and move any subtitle the tool leaves behind. Subtitle migration notes

import type { Meta, StoryObj } from '@storybook/react-vite';
import { Toggle } from './Toggle';

const meta = {
  title: 'Migration/Toggle',
  component: Toggle,
  tags: ['autodocs'],
  parameters: { docs: { subtitle: 'Toggle button states' } },
} satisfies Meta<typeof Toggle>;

export default meta;

export const Default: StoryObj<typeof meta> = {
  args: { label: 'Toggle alerts' },
};

The fixture ran on Linux with Node.js 24.22.2, npm 11.19.1, React and React DOM 19.2.0, Vite 7.3.8 and TypeScript 5.9.3. The CLI, framework and Docs addon all used the Storybook version listed for each build.

BuildStatic build and CanvasDocs
Storybook 10.6.10 baselineBuild passed. Clicking the toggle changed aria-pressed from false to true.Subtitle and label prop row appeared.
Storybook 11.0.2 with the old subtitle keyBuild passed.The label row appeared and the subtitle was missing.
Storybook 11.0.2 after the subtitle migrationBuild passed. The same click changed aria-pressed from false to true.Subtitle and label prop row appeared.

Load ?path=/story/migration-toggle--default from the built site and check the button state. Then load ?path=/docs/migration-toggle--docs and check the subtitle and the prop row separately. A green build and a working button can leave gaps in Docs. If your props come from a shared type or your docs depend on custom prop filtering, use a component that exercises that setup. The fixture's single typed prop covers the simplest extraction path.

Carry the browser check into CI

The fixture covered the built Canvas and Docs views in Chrome 158.0.8127.107. If you use @storybook/test-runner, give the runner its own checkpoint before retiring the old CI job. Storybook documents that this runner is incompatible with Storybook 11 and provides a migration to @storybook/addon-vitest for Vite projects. The addon requires Vitest 4.0 or later. Run your own existing play tests in browser mode and check that CI still fails on a broken assertion. The click check above used the built story directly. Storybook test-runner migration · Vitest addon version requirement

Install from the committed lockfile on the pinned CI runtime, then build from a clean checkout. Serve the artifact under the path your team uses and open a direct story link from a fresh browser session. Check that the manager, preview frame and any fonts or other static assets load there. Repeat the Docs and interaction checks on a story that uses your real decorators and providers. For a visual review service or a community addon, run the workflow your team actually depends on and compare it with the baseline.

Switch the published artifact after those checks pass. If the release fails, restore the last passing package manifest, lockfile, Storybook configuration and story changes together, or republish the saved static build while you investigate. Keeping the story format conversion for a separate change makes that rollback easier. Storybook documents the move from CSF 3 to CSF 4 as optional, and the test project kept CSF 3. Optional CSF migration

Source notes