skip to content

In a design system, what sections belong in a shared component's spec, and what failure does each section prevent?

level: middleimportance: must knowfreq 48%

answer

  1. parts, options, conditions, rules
  2. anatomy names every part
  3. variants versus states
  4. redlines point at tokens
  5. content and accessibility notes

basics

~20 s

A component spec covers anatomy, variants, states, behaviour, content rules, spacing and sizing redlines, and accessibility notes. Each closes a gap that different teams would otherwise fill differently: unnamed parts, missing states, invented behaviour, broken copy, drifting spacing and inaccessible builds.

solid answer

~40 s

A spec is the build contract for a shared component, so each section answers a question two teams would otherwise answer differently. **Anatomy** names every part so design, code and documentation use the same words. **Variants** list the options a consumer chooses, such as size or emphasis; **states** list the runtime conditions, such as hover, focus, disabled, loading and error, ideally as a variant-by-state matrix. **Behaviour** covers interaction, keyboard, responsiveness, overflow and motion. **Content rules** set label length, truncation and how text expands in translation. **Redlines** give spacing and sizing as token references, not raw numbers, so they survive theme and density changes. **Accessibility notes** name the role or pattern, where the accessible name comes from, keyboard and focus behaviour, and contrast needs. Around them sit purpose, status, open questions and a changelog.

go deeper

for a junior

Recall the core sections, anatomy, variants, states, behaviour, content rules, redlines and accessibility notes, and what each one is for.

for a middle

Explain the failure each section prevents, why states need a matrix and why redlines reference tokens instead of numbers.

for a senior

Show how you would judge a spec by its gaps: whether two platform teams could build the same component from it without a meeting.

for a principal

Decide how much rigour the template demands per component, and what a heavy template costs contributors against what a light one costs consumers.

## What a spec is for A **component spec** is the document that defines a shared component precisely enough that a designer, a web engineer and a native mobile engineer build the same thing without meeting. It is not the usage page that tells product teams when to pick the component, and it is not the release checklist that decides whether it can ship; it is the **contract** those two rely on. The test of a good spec is simple: hand it to two engineers on two platforms, and compare what they build. Every difference is a missing sentence. ## The sections, and the failure each prevents | Section | What it records | Failure it prevents | |---|---|---| | Anatomy | every named part, required or optional | teams naming parts differently, parts dropped on one platform | | Variants | options chosen when placing the component: size, emphasis, layout | ad hoc variants invented per product | | States | runtime conditions: rest, hover, focus, pressed, selected, disabled, loading, error | the unhappy states nobody designed | | Behaviour | interaction, keyboard, responsive rules, overflow, motion | engineers inventing behaviour under deadline | | Content rules | label length, casing, truncation, translation expansion, empty values | layouts breaking on real copy | | Spacing and sizing redlines | internal padding, gaps, sizes, as token references | drift between platforms and modes | | Accessibility notes | role or pattern, accessible name source, keyboard, focus, contrast, target size | inaccessible builds discovered at audit | ## States deserve a matrix States are where specs are thinnest. A spec that shows only the default mockup leaves the most error-prone looks to improvisation. The rigorous form is a **matrix** of variants against states, with impossible combinations marked (a disabled control has no hover look) and combinable ones shown (selected and focused together). ## Redlines in tokens, not pixels A redline that says the gap is 12 pixels is true in one theme, one density and one platform. A redline that references the spacing token for that role stays true when a density mode tightens spacing, when a platform converts units, and when the scale is retuned. Many specs show both, the token name as the source of truth and the resolved number for convenience. ## Content rules and accessibility notes - **Content rules** cover what real text does: the longest expected label, what truncates and what wraps, how a value reads when empty, and how much room translations need. - **Accessibility notes** name the WAI-ARIA role or Authoring Practices pattern the component follows, where its **accessible name** comes from, its keyboard and focus contract, which parts need WCAG 2.2 contrast checks, and whether it is a pointer target subject to target-size rules. - Both are written **with** the visual design, not appended after engineering starts; retrofitting them is where most rework comes from. ## Around the sections 1. **Purpose and scope**: one paragraph on what problem the component solves and what it deliberately does not. 2. **Status**: whether it is a draft, in review or matched to a release. 3. **Open questions**: decisions not yet made, so nobody mistakes silence for a decision. 4. **Changelog**: what changed and when, so consumers can tell which version they built against. ## A billing portal example In a utility company's billing portal, a shared usage meter shows electricity used against a monthly budget. Its spec names the parts (label, track, fill, budget marker, value text), the variants (standard and compact), the states (normal, near budget, over budget, loading, no data), the behaviour when usage exceeds the budget, the content rule for units and rounding, the redlines as token references, and the accessibility notes: the Authoring Practices meter pattern, a visible label as its name and value text that reads as kilowatt-hours, not only a percentage. Two platform teams can build the meter from that page alone.

  • How is a component spec different from the usage guidance on the documentation site?
    The spec is the build contract for the people making the component: parts, states, measurements, behaviour and accessibility semantics. Usage guidance is for the people consuming it: when to choose it, when not to, and alternatives. They share content, but they answer different readers, and forcing one page to do both usually leaves one audience underserved.
  • Why should redlines reference tokens rather than raw measurements?
    A token carries the decision through theme, density and platform changes, while a raw number freezes one mode and one platform. When the spacing scale or a density mode changes, token-based redlines stay correct with no edits; raw numbers silently become wrong and invite rounding differences between platforms.

saying these in an interview costs you the question

  • A spec only needs the default state; engineers can infer the rest.
  • Redlines in raw pixel values are better than naming spacing tokens.
  • Accessibility is engineering's job after the spec is finished.
  • Variants and states are the same thing and share one list.
  • A component spec needs no content rules; copy is product's problem.