Button
Triggers an action. If it navigates somewhere, it should be a link instead.
Definition
A button performs an action in the current context. The distinction from a link is not visual: buttons act, links navigate. Getting this wrong breaks keyboard behaviour, middle-click, open-in-new-tab and screen reader announcements.
Craft convention. True because the industry converged on it. Breaking it costs familiarity, not correctness.
On this plate
Reach for this when
- Triggering any action in place.
- Submitting a form.
- Opening a dialog.
Common mistakes
- Buttons used for navigation.
- Multiple primary buttons in one view.
- Disabled buttons with no explanation.
- Icon-only buttons with no accessible name.
Variants and what each means
| Variant | Meaning | Count per view |
|---|---|---|
| Primary | The expected next action | One. |
| Secondary | A real alternative | One or two. |
| Tertiary or ghost | Low-emphasis actions | As needed. |
| Destructive | Removes or destroys | Visually distinct from primary, never the default focus. |
| Link-styled button | An action that must sit inside text | Use sparingly. Behaviour still has to be a button. |
Specify every state
- Rest, hover, focus visible, active, disabled, loading, and each of those per variant.
- Loading state must prevent double submission and keep the button's width stable so the layout does not jump.
- Minimum target 24 by 24 CSS pixels for WCAG 2.2 AA, with 44 by 44 preferred on touch.
- The accessible name comes from the visible label. Icon-only buttons need aria-label and a tooltip.
- Never disable a submit button as the only way of communicating an incomplete form.
Labels, states and semantics
Do
- Label with the action, in the reader's words: Save changes, Delete project.
- Use the button element for actions and an anchor for navigation.
- Keep the label stable during loading, adding a state rather than replacing the text.
- Give icon-only buttons an accessible name and a tooltip.
Do not
- Use OK and Cancel where the consequence could be named.
- Put two primary buttons in one view.
- Disable the submit button until the form is valid, which hides why it cannot be pressed.
- Let a double press submit twice. Guard it in the handler, not only in the styling.
In practice
- i.
Cancel, Cancel
Ambiguous labelsA dialogue asking about cancelling a subscription, with buttons labelled Cancel and OK, is genuinely unanswerable. Keep subscription and Cancel subscription say what each one does.
- ii.
The disabled submit
Hiding the problemA greyed submit with no explanation leaves the reader comparing their form against an invisible rule. Letting the press happen and showing what is wrong is faster, and it is what the error summary is for.
Commonly confused with
Close neighbours that get substituted for each other. The difference is stated first, then the condition that picks one over the other.
Link
ComponentA control that moves the reader to another location, which has an address.
Key difference
A button does something on the page you are on. A link takes you somewhere else. The difference is not visual: it decides keyboard behaviour, middle-click, open in new tab and what a screen reader announces.
Use Button when
- The result is a change of state, not a change of location.
- It submits, saves, opens, toggles or deletes something.
- There is no URL that would make sense to open in a new tab.
Use Link when
- The destination has a URL, in-page anchors included.
- Opening it in a new tab or copying the address should work.
- The text can name where the reader is going.
Local chart
CMP·001 · Region III · Grid E2
This entry and the entries it is stated to connect with. Each line is labelled with what the connection means.
Continue from here
Each link says what the connection is, so you can tell a principle from an alternative from a thing people mix this up with.
Applies when you are designing
Principles behind this
The reasoning this solution is an application of.
- Consistency and StandardsHEUR·004 · Heuristic
- Fitts's LawLAW·002 · Law
- Von Restorff EffectLAW·009 · Law
- Affordances and SignifiersPRIN·007 · Principle
- Brand Color in InterfacesFND·024 · UI foundation
- EmphasisFND·018 · UI foundation
- IconographyFND·050 · UI foundation
- ShapeFND·046 · UI foundation
- Visual StatesFND·053 · UI foundation
Depends on
Get these right first, or this one will not hold.
- Accessible NamesA11Y·008 · Accessibility
- Focus IndicatorsA11Y·003 · Accessibility
- Target SizeA11Y·011 · Accessibility
Often used with
These usually appear in the same screen or the same decision.
- Destructive ActionsPAT·009 · Pattern
- Loading StatesPAT·011 · Pattern
Related concept
Connected closely enough to change how you apply this.
- Button and Action LabelsWRT·008 · UX writing
- MicrocopyWRT·001 · UX writing