Storybook
Components rendered in isolation, one story per state — living documentation, a test bench and a stakeholder demo in one. Most valuable when every requirement gets a story.
Storybook renders components outside your app, one story per meaningful state: empty, loading, error, a thousand rows, a very long name. That simple idea ends up doing several jobs at once.
The jobs it does
- Component-driven development. Build a component in isolation, against every state, before wiring it into a page. Edge cases become visible instead of theoretical.
- Living documentation. Autodocs generate prop tables from TypeScript; stories show usage. Docs that are also running code don’t rot as fast.
- A test bench. Interaction tests (play functions), accessibility checks and visual regression all run against the same stories.
- A demo without a meeting. Stakeholders can click through progress themselves.
The habit that makes it work
One story per requirement. When every functional requirement has a story, Storybook becomes the shared definition of done: product can see it, developers can build features in parallel without stepping on each other, and tests have fixtures ready-made.
Gotchas I’ve hit
- Shared mutable args. Stories that mutate shared args or context leak state into each other. Treat args as immutable.
- Iframes and viewport units.
100vh/100vwlayouts behave oddly inside Storybook’s iframe. - Interaction tests share an environment with the rest of your test runner. Sometimes a plain integration test is simpler.
- Package vs source. Stories next to components are fastest for development, but you also need to prove the built package imports and renders in a consuming app.
In practice
I’ve used Storybook for a corporate component library and, most heavily, for an in-house network graph library, where it was the docs, the demo and the test harness at once — the story is in Building a Graph Component Library. The design principles that make components story-friendly are in Headless Component Libraries, and stories as test fixtures fit neatly into React Testing Strategy.
- #storybook
- #component-libraries
- #design-systems
- #testing
- #documentation
↩ Linked from (5)
…-user feature was written tests-first (unit, integration and stories) and became the pattern the team copied (Storybook). Made quality visible and fast. I optimised the lint job so it ran several times faster, and added…
…ld use it, so the docs were part of the product. Shared the components. To speed things up further, I adopted Storybook to hold Elanco's reusable components (a shared component library), then applied them across the 80 s…
…l story is in Building a Graph Component Library, and the API design lessons in Headless Component Libraries. Storybook became the place where each capability was demonstrated and tested (Storybook).
- PlaywrightGrowing
Playwright can also mount individual components in a real browser, which makes a useful middle ground between jsdom unit tests and full end-to-end journeys. Storybook stories make good fixtures for it (Storybook).
- Web AcceleratorGrowing
…easoning written down so people know when the default fits. The component library, wired in and documented in Storybook, so every site shares one design language. Deployment and edge, already configured. CDN or front doo…
↪ Links to (3)
Related by topic
- Seed
Don't Read the Code? Verifying AI-Written Code
Platform engineering - Growing
Dotfiles: An Environment That Follows Me
Frontend craft - Seed
Low-Code Platforms: Where Do They Belong?
Platform engineering - Growing
Provisioning My Laptop with Ansible
Platform engineering