Components

Buttons

Use buttons to help users to carry out an action.

How to use

We extend the NHS design system button with the nhsapp-button modifier class so that its border radius matches the card links.

Primary button

<button
  class="nhsuk-button nhsapp-button"
  data-module="nhsuk-button"
  type="submit"
>
  Continue
</button>

{% from "button/macro.njk" import button %}

{{ button({
  text: "Continue",
  classes: "nhsapp-button"
}) }}

To use the component in your design, add the NHS App Figma library to your working files, and navigate using the components tab.

View component in Figma (opens in a new tab)

To use the component in your Vue application, install the NHS App Vue Component Library and import the component.

View component in Vue (opens in a new tab)

Secondary button

<button
  class="nhsuk-button nhsuk-button--secondary nhsapp-button"
  data-module="nhsuk-button"
  type="submit"
>
  Try again
</button>

{% from "button/macro.njk" import button %}

{{ button({
  text: "Try again",
  variant: "secondary",
  classes: "nhsapp-button"
}) }}

To use the component in your design, add the NHS App Figma library to your working files, and navigate using the components tab.

View component in Figma (opens in a new tab)

To use the component in your Vue application, install the NHS App Vue Component Library and import the component.

View component in Vue (opens in a new tab)

Buttons on dark backgrounds (reverse button)

<button
  class="nhsuk-button nhsuk-button--reverse nhsapp-button"
  data-module="nhsuk-button"
  type="submit"
>
  Continue
</button>

{% from "button/macro.njk" import button %}

{{ button({
  text: "Continue",
  variant: "reverse",
  classes: "nhsapp-button"
}) }}

To use the component in your design, add the NHS App Figma library to your working files, and navigate using the components tab.

View component in Figma (opens in a new tab)

To use the component in your Vue application, install the NHS App Vue Component Library and import the component.

View component in Vue (opens in a new tab)

Warning button

<button
  class="nhsuk-button nhsuk-button--warning nhsapp-button"
  data-module="nhsuk-button"
  type="submit"
>
  Cancel appointment
</button>

{% from "button/macro.njk" import button %}

{{ button({
  text: "Cancel appointment",
  variant: "warning",
  classes: "nhsapp-button"
}) }}

To use the component in your design, add the NHS App Figma library to your working files, and navigate using the components tab.

View component in Figma (opens in a new tab)

To use the component in your Vue application, install the NHS App Vue Component Library and import the component.

View component in Vue (opens in a new tab)

Help improve this component

The NHS App design system team would like to hear:

  • how you have used this component in your service
  • any feedback you have about its usage, for example accessibility or ideas for improvement

Add these comments to the 'Buttons' discussion on GitHub.