Repository: storybookjs/storybook
Stars: 89728
.cursorrules
Test Configuration
This Storybook repository uses Vitest as the test runner. Here are the key commands and configuration:
Test Scripts
- yarn test - Run all tests (from root directory, delegates to cd code; yarn test)
- yarn test <test-name> - Run focused tests matching the pattern
- yarn test:watch - Run tests in watch mode
- yarn test:watch <test-name> - Run focused tests in watch mode
Test Directory Structure
- Tests are located in the code/ directory
- Vitest configuration is in code/vitest.workspace.ts
- Test files typically follow the pattern .test.ts, .test.tsx, .spec.ts, or .spec.tsx
Running Tests in Cursor
1. Use Cmd+Shift+P (or Ctrl+Shift+P) and search for "Tasks: Run Task"
2. Select from the available test tasks:
- "Run All Tests" - Runs all tests
- "Run Test (Watch Mode)" - Runs tests in watch mode
- "Run Focused Test" - Prompts for test name/pattern to run specific tests
- "Run Focused Test (Watch Mode)" - Runs specific tests in watch mode
Vitest Configuration
- Workspace configuration: ./code/vitest.workspace.ts
- Command line: yarn --cwd code test
- Root directory for tests: ./code/
Test Execution Context
- Tests run from the code/ directory
- Use NODE_OPTIONS=--max_old_space_size=4096 for memory optimization
- Supports both watch mode and single-run execution
Focused Test Patterns
When running focused tests, you can use:
- File names: Button.test.ts
- Test descriptions: "should render correctly"
- Directory patterns: components/
- Vitest patterns: -t "pattern" for test name matching
Test Mocking Rules
Follow the spy mocking rules defined in .cursor/rules/spy-mocking.mdc for consistent mocking patterns with Vitest.
CLAUDE.md
@AGENTS.md
README.md
<p align="center">
<a href="https://storybook.js.org/?ref=readme">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/263385/199832481-bbbf5961-6a26-481d-8224-51258cce9b33.png">
<img src="https://user-images.githubusercontent.com/321738/63501763-88dbf600-c4cc-11e9-96cd-94adadc2fd72.png" alt="Storybook" width="400" />
</picture>
</a>
</p>
<p align="center">Build bulletproof UI components faster</p>
<br/>
<p align="center">
<a href="https://circleci.com/gh/storybookjs/storybook">
<img src="https://circleci.com/gh/storybookjs/storybook.svg?style=shield" alt="Build Status on CircleCI" />
</a>
<a href="https://codecov.io/gh/storybookjs/storybook">
<img src="https://codecov.io/gh/storybookjs/storybook/branch/main/graph/badge.svg" alt="codecov" />
</a>
<a href="https://github.com/storybookjs/storybook/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/storybookjs/storybook.svg" alt="License" />
</a>
<br/>
<a href="https://discord.gg/storybook">
<img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" />
</a>
<a href="https://storybook.js.org/community/?ref=readme">
<img src="https://img.shields.io/badge/community-join-4BC424.svg" alt="Storybook Community" />
</a>
<a href="#backers">
<img src="https://opencollective.com/storybook/backers/badge.svg" alt="Backers on Open Collective" />
</a>
<a href="#sponsors">
<img src="https://opencollective.com/storybook/tiers/sponsors/badge.svg" alt="Sponsors on Open Collective" />
</a>
<a href="https://x.com/intent/follow?screen_name=storybookjs">
<img src="https://img.shields.io/twitter/follow/storybookjs?color=blue&logo=twitter" alt="Official Twitter Handle" />
</a>
<a href="https://api.securityscorecards.dev/projects/github.com/storybookjs/storybook">
<img src="https://api.securityscorecards.dev/projects/github.com/storybookjs/storybook/badge" alt="OpenSSF Scorecard"/>
</a>
</p>
<p align="center">
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and documentation. Find out more at <a href="https://storybook.js.org/?ref=readme">storybook.js.org</a>!
</p>
<center>
<img src="https://raw.githubusercontent.com/storybookjs/storybook/refs/heads/release-6-5/media/storybook-intro.gif" width="100%" />
</center>
<p align="center">
View README for:<br/>
<a href="https://github.com/storybookjs/storybook/blob/main/README.md" title="latest"><img alt="latest" src="https://img.shields.io/npm/v/@storybook/react/latest?style=for-the-badge&logo=storybook&logoColor=ffffff&color=66BF3C" /></a>
<a href="https://github.com/storybookjs/storybook/blob/next/README.md" title="next"><img alt="next" src="https://img.shields.io/npm/v/@storybook/react/next?style=for-the-badge&logo=storybook&logoColor=ffffff&color=1EA7FD" /></a>
</p>
Table of contents
- 🚀 Getting Started
- 📒 Projects
- 🛠 Supported Frameworks & Examples
- 🔗Addons
- 🏅 Badges & Presentation materials
- 👥 Community
- 👏 Contributing
- 👨💻 Development scripts
- 💸 Sponsors
- 💵 Backers
- :memo: License
Getting Started
Visit Storybook's website to learn more about Storybook and to get started.
Documentation
Documentation can be found on Storybook's docs site.
Examples
View Component Encyclopedia to see how leading teams use Storybook.
Use storybook.new to quickly create an example project in Stackblitz.
Storybook comes with a lot of addons for component design, documentation, testing, interactivity, and so on. Storybook's API makes it possible to configure and extend in various ways. It has even been extended to support React Native, Android, iOS, and Flutter development for mobile.
Community
For additional help, share your issue in the repo's GitHub Discussions.
Projects
Supported Frameworks
| Renderer | Demo | |
| -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| React |  |  |
| Angular |  |  |
| Vue 3 |  |  |
| Web components |  |  |
| React Native |  |  |
| HTML |  |  |
| Ember |  |  |
| Svelte |  |  |
| Preact |  |  |
| Qwik |  |  |
| SolidJS |  |  |
| Android, iOS, Flutter |  |  |
Addons
| Addons | |
| ------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| a11y | Test components for user accessibility in Storybook |
| actions | Log actions as users interact with components in the Storybook UI |
| backgrounds | Let users choose backgrounds in the Storybook UI |
| cssresources | Dynamically add/remove CSS resources to the component iframe |
| design assets | View images, videos, and weblinks alongside your story |
| docs | Add high quality documentation to your components |
| events | Interactively fire events to components that respond to EventEmitter |
| google-analytics | Reports google analytics on stories |
| graphql | Query a GraphQL server within Storybook stories |
| jest | View the results of components' unit tests in Storybook |
| links | Create links between stories |
| measure | Visually inspect the layout and box model within the Storybook UI |
| outline | Visually debug the CSS layout and alignment within the Storybook UI |
| query params | Mock query params |
| viewport | Change display sizes and layouts for responsive components using Storybook |
See Addon / Framework Support Table
To continue improving your experience, we have to eventually deprecate or remove certain addons in favor of new and better tools.
If you're using info/notes, we highly recommend you migrate to docs instead, and here is a guide to help you.
If you're using contexts, we highly recommend you migrate to toolbars and here is a guide to help you.
If you're using addon-storyshots, we highly recommend you migrate to the Storybook test-runner and here is a guide to help you.
Badges & Presentation materials
We have a badge! Link it to your live Storybook example.
If you're looking for material to use in your Storybook presentation, such as logos, video material, and the colors we use, you can find it all on our brand repo.
Community
- Tweeting via @storybookjs
- Blogging at storybook.js.org and Medium
- Chatting on Discord
- Videos and streams at YouTube
Contributing
Contributions to Storybook are always welcome!
- 📥 Pull requests and 🌟 Stars are always welcome.
- Read our contributing guide to get started,
or find us on Discord, we will take the time to guide you.
Looking for a first issue to tackle?
- We tag issues with  when we think they are well suited for people who are new to the codebase or OSS in general.
- Talk to us, we'll find something that suits your skills and learning interests.
Development scripts
Storybook is organized as a monorepo. Useful scripts include:
#### yarn start
Runs a sandbox template storybook with test stories
#### yarn task
As above, but gives you options to customize the sandbox (e.g. selecting other frameworks)
#### yarn lint
boolean check if code conforms to linting rules - uses remark & eslint
- yarn lint:js - will check js
- yarn lint:md - will check markdown + code samples
- yarn lint:js --fix - will automatically fix js
#### yarn test
boolean check if unit tests all pass - uses jest
- yarn run test --core --watch - will run core tests in watch-mode
Sponsors
Become a sponsor to have your logo and website URL on our README on Github. \[Become a sponsor]
<a href="https://opencollective.com/storybook/tiers/sponsors/0/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/0/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/1/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/1/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/2/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/2/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/3/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/3/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/4/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/4/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/5/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/5/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/6/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/6/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/7/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/7/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/8/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/8/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/9/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/9/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/10/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/10/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/11/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/11/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/12/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/12/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/13/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/13/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/14/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/14/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/15/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/15/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/16/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/16/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/17/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/17/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/18/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/18/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/19/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/19/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/20/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/20/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/21/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/21/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/22/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/22/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/23/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/23/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/24/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/24/avatar.svg?requireActive=true"></a>
<a href="https://opencollective.com/storybook/tiers/sponsors/25/website?requireActive=true" target="_blank"><img src="https://opencollective.com/storybook/tiers/sponsors/25/avatar.svg?requireActive=true"></a>
Backers
By making a recurring donation, you can support us and our work. \[Become a backer]
<a href="https://opencollective.com/storybook"><img src="https://opencollective.com/storybook/tiers/backers.svg?limit=80&button=false&avatarHeight=46&width=750"></a>
License
-the end-