EduFlow

Section 3 · Components

Documentation People Actually Read

18 min4 min readChoose wisely

Lesson at a glance

Structure component documentation around how people actually read it, generate the parts that drift, and write the guidance only humans can give, such as when not to use a component.

  1. 1Anatomy of a component page
  2. 2Generate what drifts, write what can’t be generated
  3. 3Docs are part of done

No video here — just the real thing: a written lesson, runnable examples, a quiz and practice.

Northwind’s first documentation site had 140 pages, a beautiful typeface and a principles section that took a month to write. Our analytics told a humbling story: on component pages, the median visit lasted 38 seconds. People landed, scrolled to the first code block, copied it, and left. The principles section averaged nine visits a week, most of them from our own team.

That’s not a failure of the readers. Engineers and designers open documentation in the middle of a task with one question: “Is this the right component, and how do I use it?” Good documentation answers that in the first screen and keeps everything else one scroll away.

Anatomy of a component page

Every Northwind component page follows the same order, so people learn where to look:

  1. One-line description of what the component is for.
  2. When to use, when not to use, with links to the alternative. “Use Dialog for decisions that block the current task. For non-blocking messages, use Toast.”
  3. The primary example: a live demo of the most common correct usage, with copyable code.
  4. Examples of each variant and important state, each with its own code.
  5. Accessibility: keyboard behavior, what screen readers announce, and a split between what the component handles and what the team must still do (for example, “you must give every Dialog a Dialog.Title”).
  6. Content guidelines: how to write labels and messages. “Button labels start with a verb: Assign driver, not Driver assignment.”
  7. Props table, generated from code.
  8. Status and history: stable, beta or deprecated; the version it was added; links to the changelog.

The order follows what people need under time pressure. The decision (“should I use this?”) and the copyable example come first; reference material comes last.

Generate what drifts, write what can’t be generated

Two parts of a docs page go stale fastest: props tables and code examples. Both can come from code. Props tables are generated from TypeScript types. Examples come from stories, the same files used for development and visual tests. In Storybook, a story file with the autodocs tag gets a generated docs page with a live preview, the story’s code, and a controls table built from the component’s props:

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

const meta = {
  component: Button,
  tags: ['autodocs'],
  args: { children: 'Assign driver' },
} satisfies Meta<typeof Button>;
export default meta;

type Story = StoryObj<typeof meta>;

export const Secondary: Story = {};
export const Primary: Story = { args: { variant: 'primary' } };
export const Danger: Story = { args: { variant: 'danger', children: 'Delete route' } };
export const Small: Story = { args: { size: 'sm' } };

What code can’t generate is judgment: when to use the component, when not to, how to word its content, and why the system made the choices it did. That’s where the docs team’s writing time goes.

Docs are part of done

Documentation that ships later doesn’t ship. Northwind’s pull request template for system components has a checklist: stories for every variant and state, an updated docs page, an accessibility section, and a changelog entry. A component change without them doesn’t merge. Because the docs live in the same repository as the components, they’re reviewed in the same pull request by the same people.

Then treat the docs like a product. Northwind tracks three signals: search queries that return no results, the questions asked in the design system Slack channel, and pages with high exit rates right after the “when to use” section. Each repeated question becomes a docs change. If the same question arrives three times, the answer belongs on the page, not in a thread.

In the exercise, you plan the documentation fixes for a real misuse. That completes the components section; next, you connect the design side and the code side of the system so they stay in sync.

Key takeaways

  • People scan documentation for a copyable example and a yes-or-no answer to “should I use this?”, so put those first.
  • Every component page needs “when to use” and “when not to use”, with links to the right alternative.
  • Generate props tables and examples from code and stories so they can’t drift; write by hand only what code can’t express.
  • Documentation is part of the definition of done and ships in the same pull request as the component change.

Further reading

Check your understanding

3 questions

Question 1 of 3

Analytics show most visitors to Northwind’s Button page leave within 40 seconds after copying the first code example. What should you conclude?

Question 2 of 3

Teams keep using the Danger button for “Remove filter”, which isn’t destructive. Which documentation change helps most?

Question 3 of 3

The Button props table in the docs lists a kind prop that was renamed to variant two releases ago. What’s the durable fix?

Practice

Choose wisely

Fix the docs behind a misuse

Dispatchers complain that the app keeps interrupting them: six teams now open a blocking Dialog that says “Route saved!” after every save. You check the Dialog docs page. It opens with a live demo of exactly that success dialog, followed by a complete props table. There is no guidance on when to use Dialog versus Toast. Which changes would you make? Select all that apply.

Fix the docs behind a misuse