Skip to main content
Official government website

Button

Buttons let users carry out an action.

Examples
HTML and React
Group
Actions
On this page

Preview

Button variants
Open in new tab

The Button component lets users initiate an action, such as submitting a form, starting an application, or saving their information. The label on a button describes the action it performs.

Usage

When to use

  • Use a button for a clear action that changes the page, saves progress or moves the task forward.
  • Use the button style that matches the importance and consequence of the action.

When not to use

  • Do not use a button for navigation when a link would be clearer.
  • Do not use vague labels that force users to guess what happens next.

Best practices

Write button text in sentence case.

Use a clear action label

Specific labels help users understand the outcome before they act.

Do not use vague labels

Generic labels force users to read surrounding text to understand what happens.

Variants

Use the secondary button for actions that sit alongside the primary one but are less important. Use the tertiary button for the least prominent actions.

Use the ghost button for an action that must not compete with the buttons around it, such as Cancel beside a primary button or the Menu control in the header. It carries no fill or outline, only an underlined label, but it keeps the same box as the other variants, so a row of mixed buttons lines up and the target stays full size.

Use the text button only where there is no room for that box, such as Remove in a table cell or a list row. It is the ghost button without its padding, so it sits flush with the text around it.

Both are still buttons: use them for actions, and use a link for navigation.

Ghost and text buttons
Open in new tab

Use LinkButton when navigation is the primary call to action. It remains a semantic link and also supports external when a separate service must open in a new tab.

External link styled as a button
Open in new tab

Destructive actions

Add the negative modifier to a primary, ghost or text button when the action destroys data or cannot be undone, such as deleting a record. It is a warning, not a substitute for confirmation: pair it with a step that lets the user check what they are about to lose. Do not use it for ordinary actions, because a page full of red buttons stops reading as a warning.

Destructive actions
Open in new tab

Buttons on dark backgrounds

Add the inverse modifier when a button sits on a dark or brand-coloured surface, such as a hero panel. It flips the primary button to a white fill with brand-blue text, and turns the tertiary, ghost and text variants white so they stay visible. The surrounding surface must supply the dark background: the modifier only recolours the button.

Inverse buttons
Open in new tab

Client-side routing

LinkButton accepts an href-compatible router component through linkComponent, so a start button can navigate without a full page load. The router renders the same markup a plain link-button does.

Start button rendered by a client-side router
Open in new tab

Disabled buttons

Avoid disabling buttons wherever possible. A disabled button gives the user no information about what they need to do to enable it. Prefer keeping the button active and showing an error when the user tries to continue.

Disabled button
Open in new tab

A link cannot take the disabled attribute, so a LinkButton that must appear unavailable uses aria-disabled="true" instead. That styles it as disabled and announces it as such, but the link still works: stop the navigation in your own handler.

Grouping buttons

When a page offers more than one action at the same point, wrap them in a govbb-button-group. It lays out the actions in a row with a consistent gap, wrapping on narrow screens. Put the primary action first, and use secondary or tertiary buttons for the rest. A text link, such as Cancel, can sit in the group alongside the buttons.

For Back and Continue navigation in a question flow, follow the single-question page template, which places Back before Continue.

Button group
Open in new tab

Add the govbb-button-group--vertical modifier to stack the actions and stretch each one to the full width of the group, for narrow layouts or full-width action stacks, such as accept and reject choices on mobile.

Vertical button group
Open in new tab