Component Anatomy, States and Variants
A component is finished when its parts, its states and the reason each variant exists are all written down.
Definition
Anatomy names the parts of a component. States describe how each part responds to interaction and context. Variants are the deliberate alternatives. Undocumented, all three get reinvented by whoever needs them next.
Craft convention. True because the industry converged on it. Breaking it costs familiarity, not correctness.
On this page
The specification checklist
| Aspect | What to define | Common omission |
|---|---|---|
| Anatomy | Required and optional parts, and their order | Optional parts nobody knew were optional. |
| States | Default, hover, focus, active, selected, disabled, loading, error, read-only | Focus and read-only, almost always. |
| Variants | Each alternative plus the condition for choosing it | Variants with no stated difference in meaning. |
| Sizes | The scale and what each size is for | A size added for one screen and kept forever. |
| Content limits | Minimum and maximum content, and wrapping behaviour | Behaviour with a very long label, or none. |
| Accessibility contract | Role, name, keyboard behaviour, announced state | State changes that are visual only. |
Keeping the set honest
Do
- Give each variant a meaning, not a look: destructive, not red.
- Document the decision rule between neighbouring variants in one sentence.
- Specify what happens with the longest realistic content and with none at all.
- Treat read-only and disabled as different states, because they mean different things.
Do not
- Do not add a variant for a single screen. Style it locally, and promote it if it recurs.
- Do not let a variant set grow past what a designer can hold in memory. Beyond about five, nobody chooses correctly.
- Do not express state with colour alone.
- Do not spec a hover state without specifying its touch equivalent.
In practice
Read-only versus disabled
A disabled field says 'you cannot change this now'. A read-only field says 'this value is fixed'. Rendering both at 40 percent opacity makes a permanent value look like a temporary block, and generates support questions about how to enable it.
Continue from here
Each link says what the connection is, so you can tell a principle from an alternative from a thing people mix this up with.
Related concept
Connected closely enough to change how you apply this.
- Focus IndicatorsAccessibility
- Specification to Working CodeAI workflow
- Component API DesignDesign system
- Design and Code ParityDesign system
- Design System DocumentationDesign system
- Design TokensDesign system
- Visual StatesUI foundation