Form design
Best practice, research insights and examples
Here's my best practice guidelines for form design.
Working on a design system for a bank taught me a lot about forms. I watched testing in labs. I worked alongside experts from specialist accessibility organisations. I saw forms tested by people with disabilities and users of assistive technology. I've also read a lot of research.
From all this learning I've formed my own forms best-practice guidelines. I thought it would be useful start recording it. Here's my work in progress. I do UI/UX so I'm coming at this from a designer's perspective.
👋 Hey, I haven't updated this page in a while 👋
I stand by the advice but the insights are a little tired. Use at your own risk! If you want current form advice, head over to form expert Adam Silver's blog.
First, some principles
It's important to start with with a set of principles. It's easy to become swayed by design trends and I have to bring myself back to the user.
I aspire to the Inclusive Design Principles. Designing forms for people experiencing permanent, temporary or situational disabilities improves the experience for everyone. I also look to the WCAG principles. Your website or app must be:
- perceivable
- operable
- understandable
- robust and compatible
In summary, think of your user and keep things as simple and as functional as possible. But don't overvalue simplicity and style at the cost of clarity. In the words of Luke Wroblewski "obvious always wins".
Back to top ↑Text input
Simple input for a form. Easy to overcomplicate.
My guidelines
- Text input fields must have a visible label above the input box.
- Don't rely on placeholder text. It is not a substitute for a label.
- Place hint text under the form label.
- The size of the input box should reflect the intended input.
- Unless labelled otherwise, all fields in a form are required. Mark optional fields as 'optional'.
Research insights and sensible thinking
☞ Placeholders
- W3C Placeholder Research
- Don't Put Hints Inside Text Boxes in Web Forms by Caroline Jarrett, UXmatters
- Placeholders in Form Fields Are Harmful by By Katie Sherwin, Nielsen Norman Group.
- Placeholders are problematic by Adam Silver.
- The Problem with Placeholders by Raghavendra Satish Peri, Deque Systems.
☞ Labels
- Label Placement in Forms by Matteo Penzo, UXmatters.
- Always use a label by Adam Silver.
- Mobile Form Usability: Never Use Inline Labels by Baymard Institute.
- Float label pattern by Brad Frost.
- Advanced Form Labelling by WebAIM.
- Material Design Text Fields Are Badly Designed by Adam Silver.
- Stop using Material Design text fields! by Matsuko Friedland.
- Web Form Design by Luke Wroblewski [Left-Aligned Labels snippet]
☞ Layout
- Avoid Multi-Column Layouts by Baymard Institute
Accessibility considerations for text input
- Text needs a 4.5:1 contrast ratio against the background. WCAG 1.4.3
- Input box outline needs a 3:1 contrast ratio against the background. WCAG 1.4.11
- Not all screenreaders read out placeholder text. See also W3C placeholder research.
- Not all browsers support placeholder text.
Text fields in the wild
The component gallery: Text input
Back to top ↑Buttons
Buttons trigger an action or event such as continuing to the next stage or submitting a form. Use them purposely.
My guidelines
- Button text should describe the action the button performs and be consistent through the journey.
- Don't overload the user with choices. Use only one primary button on each page for the main action.
- Place the submit button where users look for it. In a standard form journey this is usually to the left edge of the form, directly below the final field.
- Make destructive buttons like cancel or previous harder for the user to find. A back button or link often works well above the form.
- Avoid disabled buttons. They have poor contrast and can cause confusion.
Research insights and sensible thinking
- Buttons in Design Systems by Nathan Curtis.
- Primary & Secondary Actions in Web Forms by Luke Wroblewski.
- Basic Best Practices for Buttons by Caroline Jarrett.
- Where to put buttons on forms by Adam Silver.
- Where to put buttons on forms by Adam Silver.
- The problem with disabled buttons and what to do instead by Adam Silver.
- Disabled buttons suck by Hampus Sethfors, Axess Lab.
- Articles About Buttons by Luke Wroblewski.
Accessibility considerations for buttons
- Button text needs a 4.5:1 contrast ratio against the button container colour. WCAG 1.4.3
- Button container needs a 3:1 contrast ratio against the background. WCAG 1.4.11
- When speccing out a button, remember to include a design for all the states; default, focus, hover, active. All states need sufficient colour contrast.
Buttons in the wild
The component gallery: Buttons
Back to top ↑Radio buttons
I like big radio buttons (and I cannot lie). They show all available choices upfront. Use a radio group when the user can only select one option from a list.
My guidelines
- Position radio buttons to the left of the label and stack options vertically.
- Users can only select one option but don't assume that they will know this.
- Once an option has been selected the user can't unselect it without refreshing their browser. Consider adding a 'none' option.
- Order radios from most to least common options. If this will cause an unwanted bias, order options alphabetically.
- Place hint text under the form label.
- Make radio buttons easy to tap, with a target height of at least 44 pixels.
- Radio buttons must ALWAYS be round.
Research insights and sensible thinking
- Max number of radio buttons? See Millers Law: The average person can only keep 7 items in their working memory.
- Contradicted by: UX Myth #23: Choices should always be limited to 7 :)
- We've updated the radios and checkboxes on GOV.UK Government Digital Service.
- Radio buttons: Select one by default or leave all unselected? by Kara Pernice, Nielsen Norman Group.
- Making radio buttons and checkboxes easier to use by Robin Whittleton, GDS blog.
- Making labels and legends headings Government Digital Service.
- Making radio buttons and checkboxes easier to use by Robin Whittleton, GDS blog.
- Customize checkbox and radio button with CSS by Geoffrey Crofte.
Accessibility considerations for radio buttons
- Text needs a 4.5:1 contrast ratio against the background. WCAG 1.4.3
- Radio button outline and fill needs a 3:1 contrast ratio against the background. WCAG 1.4.11
- For an accessible label, group radio buttons together in a field set and legend that describes them.
- Selecting a radio button must not cause anything surprising to happen like submitting a form, significantly changing the content on the page, or moving the keyboard focus. WCAG 3.2.2
Radio buttons in the wild
The component gallery: Radio buttons
Back to top ↑Checkboxes
Use a checkbox to select multiple items, they show all choices upfront. Users are generally familiar with the affordance of checking a box.
My guidelines
- Position checkboxes to the left of the label and stack options vertically.
- Make it clear that the user can select multiple options.
- Place hint text under the form label.
- Use a single checkbox where a user needs to indicate agreement (for example to terms and conditions).
- Make checkboxes easy to tap, with a target height of at least 44 pixels.
- Checkboxes must ALWAYS be square.
Research insights and sensible thinking
- Max number of radio buttons? See Millers Law: The average person can only keep 7 items in their working memory.
- Contradicted by: UX Myth #23: Choices should always be limited to 7 :)
- We've updated the radios and checkboxes on GOV.UK Government Digital Service.
- Making radio buttons and checkboxes easier to use by Robin Whittleton, GDS blog.
- Making labels and legends headings Government Digital Service.
Accessibility considerations for checkboxes
- Text needs a 4.5:1 contrast ratio against the background. WCAG 1.4.3
- Checkbox outline and checkmark needs a 3:1 contrast ratio against the background. WCAG 1.4.11
- For an accessible label, group checkboxes together in a field set and legend that describes them.
- Checking a box must not cause anything surprising to happen like submitting a form, significantly changing the content on the page, or moving the keyboard focus. WCAG 3.2.2
Checkboxes in the wild
The component gallery: Checkboxes
Back to topNotifications
Notifications alert users to important information or changes on a page. Helpful ones attracts the user's attention without interrupting the flow of the task. They often appear at the top of a page following a submit action.
My guidelines
- Notifications typically come in 4 flavours; Information, Warning, Success or Error.
- Users have a mental model for alert colours. Stick with Information=Blue, Warning=Orange, Positive=Green and Error=Red.
- Provide an additional indicator to colour, like an icon.
- Use notifications purposefully, keep text short and simple.
Research insights and sensible thinking
- Inclusive Components: Notifications by Heydon Pickering.
Accessibility considerations for notifications
- Text needs a 4.5:1 contrast ratio against the background. Check coloured text on a tinted background. WCAG 1.4.3
- Icon needs a 3:1 contrast ratio against the background. WCAG 1.4.11
- Consider users with colour vision deficiency. Test your alerts on a colour blind person, or use a free colour blind simulator like Color Oracle. See an example in my accessibility case study
- Don't rely on colour alone to convey your message. Provide an additional indicator to colour, like an icon.WCAG 1.4.1
Notifications in the wild
The component gallery: Notifications
Back to topError messages
Display an error message when there is a form validation error on submit. Explain what went wrong and how the user can fix it.
My guidelines
- Display error text above the input field.
- Use a red icon, an error message and a red border to highlight the field that needs attention.
- Use positive, conversational language in active voice. Don't say please or apologise. Just get to the point.
- Inline validation can be useful for password criteria affirmation, otherwise avoid it.
Research insights and sensible thinking
- Avoid Messages Under Fields by Adrian Roselli.
- Web Form Design: Adobe's Error Messages by Luke Wroblewski.
- Live validation is problematic by Adam Silver.
- Inline Validation in Web Forms by Luke Wroblewski.
- Avoid Default Field Validation by Adrian Roselli.
- Do you suffer from premature validation? by Aral Balkan.
- Avoid Being Embarrassed by Your Error Messages by Caroline Jarrett, UX Matters.
Accessibility considerations for error messages
- Error Identification WCAG 3.3.1
- Provide a text description when user input falls outside the required format or values W3C Techniques for WCAG 2.1
- Text needs a 4.5:1 contrast ratio against the background. Check your red text. WCAG 1.4.3
- Icon needs a 3:1 contrast ratio against the background. WCAG 1.4.11
- Consider users with colour vision deficiency. Test your error messages on a colour blind person, or using a free colour blind simulator like Color Oracle.
- Don't rely on colour alone to convey your message. Provide an additional indicator to colour, like an icon. WCAG 1.4.1
Error messages in the wild
Back to topDate input
Quickly enter a meaningful date or a date from a document.
My guidelines
- Three input fields are the easiest way for users to enter most dates.
- Clearly label input boxes to remove any confusion over date format.
- Don't automatically tab users between the fields.
- Be sympathetic to user entry, for example allow 01 and 1.
Research insights and sensible thinking
- Ask users for Dates Government Digital Service.
- Form design: from zero to hero all in one blog post by Adam Silver.
- Asking for a date of birth by Joe Lanman, Government Digital Service.
- Form design: multiple inputs versus one input by Adam Silver
Accessibility considerations for date input
- For an accessible label, group the three fields together in a fieldset and legend that describes them. See Making labels and legends headings from Government Digital Service.
- When any user interface component receives focus, it does not initiate a change of context. WCAG 3.2.1
- Text needs a 4.5:1 contrast ratio against the background. WCAG 1.4.3
- Input box needs a 3:1 contrast ratio against the background. WCAG 1.4.11
Date input in the wild
The component gallery: Date input
Back to topSelect
Select boxes allow users to select one item from a list. I'm not a fan! They don't show all the choices upfront. They can be difficult to navigate with a keyboard or a touch device. I've seen users confused by them in testing.
My guidelines
- Use select boxes as a last resort. Can you ask the question differently? Use a stepper, a radio group, or a selector instead?
- If you have to use a select box then default to the device or browser default.
Research insights and sensible thinking
- Dropdowns Should be the UI of Last Resort by Luke Wroblewski
- Burn your select tags by Alice Bartlett [video]
Accessibility considerations for select boxes
- Text needs a 4.5:1 contrast ratio against the background. WCAG 1.4.3
- Select box outline needs a 3:1 contrast ratio against the background. WCAG 1.4.11
- Selecting an option must not cause anything surprising to happen like submitting a form, significantly changing the content on the page, or moving the keyboard focus. WCAG 3.2.2
Select in the wild
The component gallery: Select
Back to top👋 These are my opinions based on my experience, research and testing to date. Yours might differ based on your goals, target audience, location and product. Test whenever you can and use your metrics to inform choices. I'm always learning so if you discover a better way of doing something I'd love to hear about it.