esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

Forms: The Shared Pattern for Collecting User Input Consistently

Learn how a design system's form pattern combines fields, labels, help text, errors, and buttons so every form in a product works the same way.

In short

A form pattern in a design system combines fields, labels, help text, errors and buttons, so every form in a product collects input the same way.

12 min readFree

What you will learn

A form is the part of a product where a person gives information, such as an email address or delivery details. Sign-up pages, checkout pages, and account settings are all forms. A design system gives teams one shared way to build them. This lesson explains that shared way, which is called the form pattern.

In this course, Forms means the design system's reusable pattern for collecting user input. It shows how form fields, labels, help text, validation, and buttons are combined and laid out, so every form in a product looks and behaves the same way. By the end, you will be able to name the parts, describe the feedback states a field can show, explain how error messages should work, and list the accessibility checks a form guideline needs.

Key words

Form pattern
A tested, shared recipe for one kind of task. Here, the recipe for collecting information from a person.
Input component
One piece a person types into or chooses, such as a text box, a menu, or a checkbox.
Label
The words that say what an input is for. It must stay visible on screen.
Helper text
A short line of help shown before the person answers. Also called hint text.
Required marker
A sign that tells people which answers must be given, or which are optional.
Validation
A check that an answer is complete and can be used.
Inline error
An error message placed right beside the field that has the problem.
Error summary
A list of all the errors in a form, placed near the top of the page.
Primary action
The main button that sends the form, such as Continue or Create account.
Screen reader
Software that reads the screen out loud for people who cannot see it well.
Focus
The field or button a person is currently using, often shown with an outline.
Read-only
A field that shows a value the person can see but cannot change.
Disabled
A field or button that is greyed out and cannot be used right now.

What is the anatomy of a form pattern?

Picture a form pattern as a stack. Each question has a label at the top, then optional helper text, then the input itself. If something goes wrong, an error message appears in the same stack, between the helper text and the input. The questions run down one column, and one primary button closes the form. Because the order is fixed, a person who has used one form already knows where to look on the next.

What are the five input parts?

  • Text field

    A box for a short typed answer, such as a name or an email address.

  • Select

    A closed menu where the person picks one option from a longer list, such as a country.

  • Checkbox

    A small square for yes or no, or for choosing several options at once.

  • Radio

    A round option where the person picks exactly one answer from a short group.

  • Toggle

    An on or off switch, usually for a setting that takes effect straight away.

A design system usually says which input suits which kind of question. The team then does not have to guess each time, and people meet the same control for the same job across the product.

Labels, helper text, and required markers

Every input needs a label that stays visible. GOV.UK's rules place labels above their fields, keep them short, write them in sentence case, and leave off the colon at the end. Placeholder text, the faint example text inside an empty box, is not a label, because it disappears once the person starts typing. Long explanations belong on a separate page. For required markers, choose one style, either marking required answers or marking optional ones, and use it everywhere. Mixing the two confuses people.

Tip

Write each label as the question the person is answering, in plain words. If the label is vague, such as Details, the person may not know what to type.

Layout, spacing, and order

  1. 1

    Use one column

    Stack fields in a single column so the eye moves down the page.

  2. 2

    Group related fields

    When several inputs answer one question, such as an address, wrap them in a group with a legend. The legend is the group's title, and screen readers read it first.

  3. 3

    Keep the same gaps

    Use the same spacing between label, input, helper text, and message in every form. The exact measurements belong to other lessons on spacing and sizing.

  4. 4

    Reserve room for errors

    Leave space for an error message so the layout does not jump when one appears. A jumping page makes people lose their place.

  5. 5

    Order and finish

    Ask questions in the order people think about the task, and end with one primary button. Several competing main buttons make the next step unclear.

What are the validation and feedback states?

A field is not one fixed picture. It changes as the person works with it. The pattern should name each state, so every designer draws it the same way. These are the states a form pattern usually covers.

  • Default

    The field as it looks before anyone touches it.

  • Focus

    The field the person is in right now. It needs a clear outline so keyboard users can see where they are.

  • Filled

    The field holds an answer. The answer should stay readable and easy to edit.

  • Error

    The answer failed a check. GOV.UK pairs a red message with a red border, so the message clearly belongs to its question.

  • Success

    The answer passed a check. Keep this state quiet, so the screen does not become noisy.

  • Disabled

    The field is greyed out and cannot be used right now. It should be clear why, or the person may think the form is broken.

  • Read-only

    The field shows a value the person can see but cannot change, such as an account number set by the system.

When should an error appear?

The timing of errors is a rule that teams often disagree on, so the guideline must settle it. GOV.UK's validation pattern says not to check a field when the person leaves it. Instead, the check runs when they press the continue or submit button. It also warns against checking an answer before the person has finished typing, because slower typers get interrupted. PatternFly takes a different view, checking a field when focus leaves it. PatternFly also advises showing errors as close to the field as possible. Both approaches can work. The guideline should choose one default and name the exceptions.

Two more rules help. When errors are found after the page is sent, the page should reload with the problems shown inline. And an inline error should disappear once the field meets the rule.

Tip

Accept reasonable answers. GOV.UK asks teams to accept postcodes with or without a space, and to ignore stray spaces and punctuation. Every rule you do not need is one error message fewer.

How do you write an error message?

  1. 1

    Say what went wrong

    Name the problem in plain words. Vague text such as Invalid input tells the person nothing they can act on.

  2. 2

    Say how to fix it

    Give the next step. If the format matters, show a correct example, such as name@example.com.

  3. 3

    Reuse the label's words

    Use words from the question, so the person can match the message to the right field.

  4. 4

    Keep it calm

    People are often stressed when they make a mistake. Avoid blame and alarm, and use polite, plain sentences.

  5. 5

    Add, do not repeat

    Do not copy the helper text into the error. Add the missing detail instead.

  6. 6

    One message per field

    If several rules fail, show the one message most likely to fix the problem, not a stack of messages.

How do you make forms accessible?

Accessibility means that every person can finish the form. That includes people who use only a keyboard, people who rely on a screen reader, and people who have trouble reading small text. A form guideline should make these needs part of the default, not an extra step for each team.

Visible labels and keyboard use

  • Visible label

    Every field needs a label people can see on screen. A label that is hidden, or that exists only in the code, does not count.

  • Keyboard use

    A person must be able to reach every field, button, and error with a keyboard, and must always see where focus is.

  • Size and contrast

    Buttons should be large enough to tap easily.

Linking errors to their fields

A screen reader user needs to hear which field has the problem. The error message must be tied to its input, so it is read out when the person reaches that field. GOV.UK places a hidden word, Error, before each message so that screen readers announce it clearly. When errors appear, GOV.UK also adds Error to the start of the page title and moves keyboard focus to the error summary.

Worked example: a sign-up form

This example uses GOV.UK's email address pattern. It is one question, but it is built from the same parts as every other field in a well-made form. Follow it from top to bottom.

  1. 1

    The label

    The label Email address sits above the box, in sentence case, with no colon. It names exactly what the person is giving.

  2. 2

    The helper text

    Under the label, one short line explains why the address is needed: We will only use this to send you a receipt. GOV.UK asks teams to say what the address is for, so people feel safe giving it.

  3. 3

    The input

    A single-line box is wide enough to show at least 30 characters, so a long address stays visible while typing. Phones should show an email keyboard, spellcheck should be off, and pasting must work.

  4. 4

    The error state

    If the address breaks the format, the group shows the error state. A red border connects the message to its question. The message reads: Error: Enter an email address in the correct format, like name@example.com. The example shows the right shape, so the person knows what to change.

  5. 5

    The error summary

    At the top of the page, the summary repeats the same sentence and links to the email box. Focus moves there, so a keyboard or screen reader user hears the problem first.

  6. 6

    The primary action

    One primary button, such as Continue, sits below the field. The earlier answers stay in place, so the person only fixes the email and does not retype the form.

Tip

Keep every answer after an error. Clearing the form forces people to start again. GOV.UK says not to clear fields when showing an error, so people can see what went wrong and edit it.

How do you write the form guideline?

A pattern only helps if teams reuse it. The form guideline is the written rulebook that says how the pattern must be built. Without it, each team builds its own version, and the product slowly stops feeling like one product. A good guideline is short enough to read in one sitting, and specific enough that two designers would draw the same form.

Do's and don'ts

  • Show errors in two places

    Do show the message beside the field and a summary at the top, both with the same wording.

  • Do not rely on colour alone

    A red field is not enough. The message itself must say what is wrong in words.

  • Do not use placeholder as the label

    Keep a visible label on every field, even when example text sits inside the box.

  • Do not rely on browser checks

    Turn off built-in browser validation and the required setting. Their messages cannot match the design system's look or wording.

  • Do not invent new controls

    If the pattern already has a select, a toggle, or a checkbox for the job, use it instead of building a new one.

Tip

Write each rule as something a reader can check, such as: show the error beside the field and in the summary. Vague advice like keep errors friendly cannot be checked.

What should the guideline specify?

A useful form guideline lists the approved inputs and when to use each one. It sets the label and helper text rules, names the feedback states, and says when errors appear. It gives the format for error messages, the place for the error summary, and the accessibility checks. Each rule should come with one correct example and one wrong example, so readers can see the difference.

Quick check

Try these two short scenarios. Each one needs the ideas from this lesson to answer.

Quick check

A team's checkout form shows every error only in a red banner at the top of the page. Their profile form shows errors under each field, worded differently. Which form guideline would fix this, and what would it specify?

Quick check

A user types a phone number with spaces and brackets, such as (020) 7946 0000. The form rejects it with the message Invalid input. The team wants a fix that follows the pattern. What should the rule say?

Sources

How is this lesson?

Last updated on 17 November 2026

Learn with me

Every lesson is free. I add new ones as I learn. Have a question, or want help with your own work? Book a short call.