Skip to content
IT glossary
FrontendUpdated December 3, 2026

Storybook

A tool for building, previewing, and checking UI components outside the main application. It lets you open a component in a browser and see how it looks and behaves in different states.

What Storybook does

Suppose you're changing an error banner that usually appears only after a failed checkout. In the app, reaching it might mean signing in, adding an item to the cart, and making a payment fail. In Storybook, you can open that exact state from a sidebar. The preview renders the real component from your codebase, not an image of what it should look like.

How stories work

A story is a named, reproducible example of a component or a larger piece of UI. Teams typically keep stories in *.stories.* files alongside the relevant components. A story can supply inputs through args, such as a label, a list of items, or a flag that disables a button. The Controls panel lets you tweak supported inputs in the browser without editing the story file.

Isolation means you don't need to boot the entire app; it doesn't mean the component suddenly has no dependencies. If it needs a theme or router context, a Storybook decorator can wrap it with the right provider. If it fetches data, you can provide a mock response so that an empty result or a server error is easy to reproduce.

Example: a button with two states

This React story file, Button.stories.jsx, assumes Button accepts label and disabled props:

import { Button } from './Button';

export default {
  title: 'UI/Button',
  component: Button,
};

export const Ready = {
  args: { label: 'Save', disabled: false },
};

export const Disabled = {
  args: { label: 'Save', disabled: true },
};

Storybook lists both examples under UI/Button. A reviewer can jump straight to the disabled state without filling out a form or knowing which validation rules would normally make the button unavailable.

Documentation, review, and testing

Design-system teams use Storybook to show what components are available and when to use each variant. A static build can be published separately from the product, giving designers, developers, and QA a shared place to review changes. Stories can also serve as test fixtures: a play function can simulate interactions and assert the result, and a configured visual regression tool can compare screenshots against approved baselines. Merely rendering a story does not make it a test.

How it comes up in interviews

You might be asked to design stories for a searchable product list. Cover loading, populated, empty, and error states, then explain how you'd make each one repeatable. For example, an empty array works as an input if the list receives items as props; a component that fetches its own data may instead need a mocked response. Leave a full flow that crosses real routes and services to an end-to-end test.