FRM-001 Give every form control a visible label
- Level
- Rule
- Verdict
- Majority (2 of 3)
- Area
- Forms
- Status
- decided, version 1.1.0
Rule
Give every form control a label that people can see at the control, beside it, above it or on its border, before, while and after they fill it in, and never let placeholder text stand in for that label.
Examples
Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.
Do: A label above every field
For example 19:30. The last table is at 21:30.
Don't: Placeholders instead of labels
Why
A label is how a person knows what a field wants, and they need to know it at every step: before they start, halfway through a long number, and when they look over their answers before sending. Text inside an empty field is gone at the first keystroke, so it cannot do that job. WCAG 2.2, 3.3.2 Labels or Instructions asks for labels or instructions where people enter something. It supports this rule and does not require all of it. This rule is about the label people see. The name the control carries in code, and how it relates to the label, is FRM-010.
Do
- Put a short label above each text field. A field for a national identity number gets the label "National ID number" above it.
- Put anything people need to fill a field correctly in visible hint text outside the field, such as "12 digits, YYYYMMDDNNNN" under the label "National ID number".
- Label every kind of control, not only text fields: selects, comboboxes, date and number fields, checkboxes, radio buttons and switches. For a checkbox or a switch, put the label right beside it and name the setting it changes, such as "Email me a receipt".
- Give a group of radio buttons or checkboxes a visible group label, such as "Delivery method" over "Collect in store" and "Home delivery". How the group label is tied to the group in code is FRM-010.
- Prefer a label that sits outside the field and never moves. A floating label that starts inside an empty field and moves to its edge on focus is fine, as long as it stays visible and readable the whole time.
- Give each control a name in code that contains its label's text, as FRM-010 requires. Tying the label to the control in code does that, and the
Fieldcomponent does it for you. - If you add placeholder text, treat it as an optional extra. The field must make sense without it, and the text must still be easy to read.
Don't
- Build a booking form where "Number of guests" and "Preferred time" exist only as grey text inside the fields.
- Hide the label from view and give the control a name only through
aria-label. - Put a required format, such as "NNNNNN-NNNN" for a company registration number, only in the placeholder of the field.
- Label a switch only "On" or "Off", or leave it with no text beside it.
- Let a floating label shrink, get cut off or fade away once a value is entered.
Exceptions
A single control may go without its own label text when visible text right beside it makes its purpose plain, such as a lone search field next to a button that reads "Search". Even then the control needs a name in code, as FRM-010 requires. Short or familiar forms, such as sign-in, are not an exception.
Verdict
Majority (2 of 3). Only the judges decide; the expert witnesses are shown but do not vote. How verdicts work
| Source | Role | Stance | Page |
|---|---|---|---|
| WCAG 2.2 | Law | Supports | 3.3.2 Labels or Instructions |
| WCAG 2.2 | Law | Supports | 2.4.6 Headings and Labels |
| WCAG 2.2 | Law | Supports | 1.4.3 Contrast (Minimum) |
| Material Design | Judge | Supports | Text fields: guidelines |
| Apple Human Interface Guidelines | Judge | Opposes | Text fields Entering data |
| Carbon Design System | Judge | Supports | Text input: usage Forms |
| GOV.UK Design System | Expert witness | Supports | Text input |
| Nielsen Norman Group | Expert witness | Supports | Placeholders in Form Fields Are Harmful, by Katie Sherwin |
Each stance links to the page it rests on, read on the date in the source register. This page never repeats what a source says; read the source itself.
History
- Version 1.1.0, : Narrowed to the visible label. The name in code is now FRM-010.
- Version 1.0.1, : Examples in English.
- Version 1.0.0, : First version.
Last checked against the other rules for conflicts on .
More in Forms: 15 rules and 12 guidelines · All rules
Justified is an independent project. It is not affiliated with, sponsored or endorsed by the organisations whose guidance it cites. Read the full statement.
Apple is a trademark of Apple Inc., registered in the U.S. and other countries and regions.