Patterns

Forms

How the form components work together. Each control has its own page; this page is about choosing between them and putting them in a form.

Which control to use

The user needs to…UseWhy
Type free text, a number, an emailText fieldThe only control for open answers.
Pick one of five or more optionsSelectSaves space; a native picker on phones.
Pick one of two to four optionsRadio groupAll options visible at a glance.
Turn one thing on or off, or pick severalCheckboxIndependent choices.
Filter or narrow a listChipInstant and reversible. Not a form answer.
Submit the formButtonOne primary action at the end.
Why

Each control tells the user what kind of answer is expected before they touch it: a box invites typing, a round dot says "only one", a square says "any number". Using the right shape is the cheapest usability win a form has.

How it is built

AtomsCheckbox, Radio, Chip, Button
MoleculesText field (label + input + hint), Select (label + control + hint)
PatternA form: molecules stacked with space-6 between, atoms for choices, one Button at the end

Layout

TopicWebMobile
ColumnsOne column for most forms, up to about 480px wide. Two columns only for short, related fields (first and last name).Always one column, full width.
Space between fieldsspace-6 (24px)space-6 (24px)
Space inside a groupspace-2 between label, input and hint.Same.
Submit buttonAt the end, left aligned with the fields, hugging its content.Full width, at the end.
Label positionAbove the field, never inside it as the only label.Above the field.

Validation and messages

Why

An error is only useful if the person can see it, understand it and fix it. So every error has an icon, the word that names the problem, and what to do, never red alone and never just "Invalid".

TopicGuidance
When to validateWhen the person leaves the field (blur) or submits, not on every keystroke. Clear the error as soon as the value is fixed.
Hint vs errorA hint says what is expected before the mistake ("8 characters or more"). An error replaces the hint, in the same place, and says how to fix it.
Required fieldsSay "(optional)" on the few optional fields instead of marking required ones with an asterisk.
Error summaryOn submit, move focus to the first invalid field, and name the problem next to it.

Accessibility

Rules

RuleReason
One primary action per form.One clear next step.
Ask only for what you need.Every field is a reason to leave.
Group related fields; separate groups with more space.Spacing shows what belongs together.
Keep the user\'s input after an error.Nobody wants to retype.