Section 1: Storybook foundations
Why design systems use Storybook
A component library needs a place where each component can be seen, used and tested on its own, outside the product screens it ends up in. Storybook is that place. It runs alongside your code as a separate development environment and renders components in isolation using examples called stories.
What Storybook gives a design system
- Isolated development: build a date picker without clicking through an app to reach it. You can render the empty, loading and error states directly.
- A visual catalogue: every component and every important state in one browsable sidebar.
- Living documentation: docs generated from the same stories and component types, so examples cannot drift from the code.
- A testing surface: stories double as test cases for interaction, accessibility and visual regression tests.
- A review tool: designers and product managers can check real behaviour in the browser, not screenshots.
Stories are the core idea
A story captures one rendered state of a component with specific inputs. A button might have stories for primary, secondary, disabled, loading and with an icon. Each story is a small, named example. Because stories are written in code, they are versioned, reviewed and updated with the component itself.
Where Storybook fits with Figma
Figma shows how a component should look. Storybook shows how it actually behaves. Many teams link the two, so each Figma component points to its Storybook page and each story shows its Figma design. Gaps between them become visible quickly, which is exactly what you want.
What can go wrong
Storybook is easy to install and easy to neglect. Common problems:
- Stories that show only the happy path, so nobody sees edge cases.
- Stories that break silently because nothing tests them.
- A sidebar with hundreds of unorganised entries.
- Documentation pages that list props but never explain when to use a component.
This course addresses each of these. By the end, your Storybook will be organised, tested in CI and useful to designers as well as engineers.
The sample library
We will use a small React and TypeScript library containing a button, text field, select, checkbox, modal and toast, styled with CSS custom properties from a token set. You can clone the starter repository or follow along with your own components.