Skip to content
NewTemplates & toolkits are on the way — join the waitlist
Hecham Gazhi

UI Design · Lesson 07 / 12

Buttons & forms

Designing the controls people act with: button hierarchy, labels, sizes and states; form layout, labels, input types, selection controls, validation and error messages that help people succeed.

5 min read · 5 quiz questions

Buttons: the anatomy

A button has a container, a label, and optionally a leading or trailing icon. Its job is to tell people clearly what will happen when they press it, and to show that it's pressable.

  • Height follows your spacing scale: commonly 32px (small), 40px (medium), 48px (large).
  • Horizontal padding is usually 12–24px depending on size.
  • Touch target should be at least 44×44pt (Apple) or 48×48dp (Material), even if the visible button is smaller.
  • Corner radius is part of your brand language — keep it consistent across all components.

Button hierarchy

TypeAppearanceWhen to use
PrimaryFilled with the accent colourThe single most important action in a view
SecondaryOutlined or tonal (light fill)Important alternatives: Save draft, Back
Tertiary / textText onlyLow-emphasis actions: Cancel, Learn more
DestructiveRed fill or red textDeleting, removing, irreversible actions
Icon buttonIcon only, with an accessible labelCompact actions: close, more, favourite

Common mistake: Two primary buttons side by side, e.g. a filled "Cancel" and a filled "Save". Users can't tell which is the main action — and some will press the wrong one.

Writing button labels

Do

  • Start with a verb that describes the result: "Send invoice", "Create account".
  • Be specific: "Delete 3 files" rather than "OK".
  • Keep it short — usually 1–3 words.
  • Match the label to the heading or question: "Delete project?" → "Delete project".

Don't

  • Use vague labels: "OK", "Submit", "Click here", "Yes".
  • Use different words for the same action in different places.
  • Write in all caps for long labels.
  • Hide important consequences: "Continue" that actually charges a card.

Button states

StateHow to show it
DefaultThe resting style
HoverSlightly darker or lighter fill; pointer cursor (desktop only)
FocusA clearly visible focus ring (2px outline with offset) for keyboard users
Pressed / activeDarker fill, sometimes a slight scale-down
DisabledLow contrast, no hover; explain why if possible
LoadingSpinner inside the button, label kept or replaced; prevent double clicks

Live preview

Button

Default

Button

Hover

Button

Focus

Button

Pressed

Button

Disabled

Button

Loading

Disabled buttons are often confusing — people don't know why they can't continue. Consider keeping the button enabled and showing what's missing when it's pressed, or explain the requirement next to it.

Form layout

  • Single column. Research by usability experts consistently finds single-column forms faster and less error-prone than multi-column ones. Exceptions: short related fields like City + Postal code.
  • Group related fields with headings (Personal details, Delivery, Payment).
  • Order fields logically — the way people think about the information.
  • Ask only what you need. Every extra field lowers completion. Remove, make optional or ask later.
  • Match field width to the expected input — a postal code field shouldn't be full width.
  • Place the primary button aligned with the inputs, at the end of the form.

Labels, placeholders and help text

Labels

Every input needs a visible label, placed above the field (fastest to scan, works on mobile and with long translations). Labels must be connected in code (<label for>) so screen readers announce them.

Placeholders

Use placeholders only for examples of format ("name@example.com"), never as the label. Placeholder text disappears as soon as people type, is usually low-contrast, and is often mistaken for a pre-filled value.

Help text

Short hints below the field explain requirements up front: "At least 8 characters, including a number". Showing rules before people type prevents errors.

Required vs optional

If most fields are required, mark only the optional ones with "(optional)". If most are optional, mark the required ones. Explain the asterisk if you use it.

Choosing the right input

NeedControlNotes
Short textText inputUse the right type: email, tel, url, number — mobile keyboards adapt
Long textTextareaShow a character limit if there is one
One choice from 2–5Radio buttonsAll options visible; one default if sensible
One choice from manySelect / dropdown or comboboxAdd search when the list is long (countries)
Several choicesCheckboxesEach independent; a single checkbox for consent
On/off that applies immediatelyToggle switchUse a checkbox instead if a Save button is needed
A dateDate picker plus typingLet people type known dates like a birthday
A number in a small rangeStepper or sliderShow the exact value
Examplehtml
<label for="email">Email</label>
<input id="email" type="email" autocomplete="email"
       inputmode="email" placeholder="name@example.com" required>
<p id="email-hint">We'll send the receipt here.</p>

Validation and error messages

  • Validate at the right time — usually when the user leaves a field (on blur) or on submit. Don't show errors while they're still typing their first attempt.
  • Show errors next to the field with an icon, colour and text — not colour alone.
  • For long forms, also show a summary at the top that links to each error, and move focus there.
  • Keep what the user typed. Never clear a form because of one error.
  • Confirm success — show that the form was submitted and what happens next.
Bad errorGood error
Invalid inputEnter an email address like name@example.com
Error: passwordPassword needs at least 8 characters — you have 6
Field requiredEnter your postal code so we can calculate delivery
422 UnprocessableThis card has expired. Use a different card.

A good error message answers three questions: What happened? Why? How do I fix it? — in plain, polite language, without blaming the user.

Key takeaways

  • Buttons need a clear hierarchy: one primary action per view, with secondary and tertiary styles.
  • Label buttons with specific verbs that describe the result.
  • Design every state: hover, focus, pressed, disabled and loading.
  • Forms work best in a single column with visible labels above fields and only necessary questions.
  • Validate at the right moment and write errors that explain how to fix the problem.

Exercise

Redesign a sign-up form

  1. Find a sign-up or checkout form with at least 8 fields.
  2. Remove or postpone every field that isn't essential.
  3. Redesign it in one column with labels above, help text and correct input types.
  4. Design error states for three fields with helpful messages.
  5. Design the button in all six states.

Test yourself

Buttons & forms quiz

5 questions. Score 70% or more to complete the lesson.

  1. 1.Which is the best button label?
  2. 2.Which form layout is usually fastest to complete?
  3. 3.Why shouldn't placeholders replace labels?
  4. 4.For choosing one option out of four, the best control is usually…
  5. 5.A good error message…