Skip to main content
Preview This is a design system preview environment for main branch

Internal review app NHS.UK frontend

Use design system guidance and examples to build consistent, accessible NHS services for the public and staff.

Button

These examples are used for automated tests and may not follow service manual best practice.

Code

Markup

<button class="nhsuk-button" data-module="nhsuk-button" type="submit">
  Save and continue
</button>

Macro

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

{{ button({
  text: "Save and continue"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--small" data-module="nhsuk-button" type="submit">
  Save and continue
</button>

Macro

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

{{ button({
  text: "Save and continue",
  small: true
}) }}
Code

Markup

<button class="nhsuk-button" data-module="nhsuk-button" type="submit" disabled aria-disabled="true">
  Disabled button
</button>

Macro

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

{{ button({
  text: "Disabled button",
  disabled: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--small" data-module="nhsuk-button" type="submit" disabled aria-disabled="true">
  Disabled button
</button>

Macro

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

{{ button({
  text: "Disabled button",
  disabled: true,
  small: true
}) }}
Code

Markup

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

Macro

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

{{ button({
  text: "Continue",
  variant: "login"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--login" data-module="nhsuk-button" type="submit" disabled aria-disabled="true">
  Continue
</button>

Macro

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

{{ button({
  text: "Continue",
  variant: "login",
  disabled: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--login nhsuk-button--small" data-module="nhsuk-button" type="submit" disabled aria-disabled="true">
  Continue
</button>

Macro

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

{{ button({
  text: "Continue",
  variant: "login",
  disabled: true,
  small: true
}) }}
Code

Markup

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

Macro

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

{{ button({
  text: "Continue",
  variant: "brand",
  classes: "nhsuk-button--login"
}) }}
Code

Markup

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

Macro

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

{{ button({
  text: "Continue",
  variant: "login",
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--login nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-button__content">Next</span>
  <svg class="nhsuk-icon nhsuk-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="m14.7 6.3 5 5c.2.2.3.4.3.7 0 .3-.1.5-.3.7l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3H5a1 1 0 0 1 0-2h11.6l-3.3-3.3a1 1 0 1 1 1.4-1.4Z"/>
  </svg>
</button>

Macro

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

{{ button({
  text: "Next",
  variant: "login",
  icon: {
    name: "arrow-right",
    placement: "end"
  }
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--login nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-button__content">Next</span>
  <svg class="nhsuk-icon nhsuk-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="m14.7 6.3 5 5c.2.2.3.4.3.7 0 .3-.1.5-.3.7l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3H5a1 1 0 0 1 0-2h11.6l-3.3-3.3a1 1 0 1 1 1.4-1.4Z"/>
  </svg>
</button>

Macro

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

{{ button({
  text: "Next",
  variant: "login",
  icon: {
    name: "arrow-right",
    placement: "end"
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--login nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content">Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  variant: "login",
  icon: {
    name: "arrow-left",
    placement: "start"
  }
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--login nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content">Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  variant: "login",
  icon: {
    name: "arrow-left",
    placement: "start"
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--reverse" data-module="nhsuk-button" type="submit">
  Log out
</button>

Macro

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

{{ button({
  text: "Log out",
  variant: "reverse"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--reverse" data-module="nhsuk-button" type="submit" disabled aria-disabled="true">
  Log out
</button>

Macro

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

{{ button({
  text: "Log out",
  variant: "reverse",
  disabled: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--reverse nhsuk-button--small" data-module="nhsuk-button" type="submit" disabled aria-disabled="true">
  Log out
</button>

Macro

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

{{ button({
  text: "Log out",
  variant: "reverse",
  disabled: true,
  small: true
}) }}
Code

Markup

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

Macro

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

{{ button({
  text: "Continue",
  variant: "brand",
  classes: "nhsuk-button--reverse"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--reverse nhsuk-button--small" data-module="nhsuk-button" type="submit">
  Log out
</button>

Macro

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

{{ button({
  text: "Log out",
  variant: "reverse",
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--reverse nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-button__content">Next</span>
  <svg class="nhsuk-icon nhsuk-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="m14.7 6.3 5 5c.2.2.3.4.3.7 0 .3-.1.5-.3.7l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3H5a1 1 0 0 1 0-2h11.6l-3.3-3.3a1 1 0 1 1 1.4-1.4Z"/>
  </svg>
</button>

Macro

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

{{ button({
  text: "Next",
  variant: "reverse",
  icon: {
    name: "arrow-right",
    placement: "end"
  }
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--reverse nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-button__content">Next</span>
  <svg class="nhsuk-icon nhsuk-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="m14.7 6.3 5 5c.2.2.3.4.3.7 0 .3-.1.5-.3.7l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3H5a1 1 0 0 1 0-2h11.6l-3.3-3.3a1 1 0 1 1 1.4-1.4Z"/>
  </svg>
</button>

Macro

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

{{ button({
  text: "Next",
  variant: "reverse",
  icon: {
    name: "arrow-right",
    placement: "end"
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--reverse nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content">Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  variant: "reverse",
  icon: {
    name: "arrow-left",
    placement: "start"
  }
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--reverse nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content">Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  variant: "reverse",
  icon: {
    name: "arrow-left",
    placement: "start"
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary" data-module="nhsuk-button" type="submit">
  Find my location
</button>

Macro

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

{{ button({
  text: "Find my location",
  variant: "secondary"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary" data-module="nhsuk-button" type="submit" disabled aria-disabled="true">
  Find my location
</button>

Macro

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

{{ button({
  text: "Find my location",
  variant: "secondary",
  disabled: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--small" data-module="nhsuk-button" type="submit" disabled aria-disabled="true">
  Find my location
</button>

Macro

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

{{ button({
  text: "Find my location",
  variant: "secondary",
  disabled: true,
  small: true
}) }}
Code

Markup

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

Macro

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

{{ button({
  text: "Continue",
  variant: "brand",
  classes: "nhsuk-button--secondary"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--small" data-module="nhsuk-button" type="submit">
  Find my location
</button>

Macro

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

{{ button({
  text: "Find my location",
  variant: "secondary",
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary-solid" data-module="nhsuk-button" type="submit">
  Find my location
</button>

Macro

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

{{ button({
  text: "Find my location",
  variant: "secondary-solid"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary-solid" data-module="nhsuk-button" type="submit" disabled aria-disabled="true">
  Find my location
</button>

Macro

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

{{ button({
  text: "Find my location",
  variant: "secondary-solid",
  disabled: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary-solid nhsuk-button--small" data-module="nhsuk-button" type="submit" disabled aria-disabled="true">
  Find my location
</button>

Macro

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

{{ button({
  text: "Find my location",
  variant: "secondary-solid",
  disabled: true,
  small: true
}) }}

Button secondary, solid background class overriding variant option

Open this example in a new tab: Button secondary, solid background class overriding variant option

Code

Markup

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

Macro

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

{{ button({
  text: "Continue",
  variant: "brand",
  classes: "nhsuk-button--secondary-solid"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary-solid nhsuk-button--small" data-module="nhsuk-button" type="submit">
  Find my location
</button>

Macro

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

{{ button({
  text: "Find my location",
  variant: "secondary-solid",
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary-solid nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-button__content">Next</span>
  <svg class="nhsuk-icon nhsuk-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="m14.7 6.3 5 5c.2.2.3.4.3.7 0 .3-.1.5-.3.7l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3H5a1 1 0 0 1 0-2h11.6l-3.3-3.3a1 1 0 1 1 1.4-1.4Z"/>
  </svg>
</button>

Macro

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

{{ button({
  text: "Next",
  variant: "secondary-solid",
  icon: {
    name: "arrow-right",
    placement: "end"
  }
}) }}

Button secondary, solid background with icon at end, small

Open this example in a new tab: Button secondary, solid background with icon at end, small

Code

Markup

<button class="nhsuk-button nhsuk-button--secondary-solid nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-button__content">Next</span>
  <svg class="nhsuk-icon nhsuk-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="m14.7 6.3 5 5c.2.2.3.4.3.7 0 .3-.1.5-.3.7l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3H5a1 1 0 0 1 0-2h11.6l-3.3-3.3a1 1 0 1 1 1.4-1.4Z"/>
  </svg>
</button>

Macro

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

{{ button({
  text: "Next",
  variant: "secondary-solid",
  icon: {
    name: "arrow-right",
    placement: "end"
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary-solid nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content">Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  variant: "secondary-solid",
  icon: {
    name: "arrow-left",
    placement: "start"
  }
}) }}

Button secondary, solid background with icon at start, small

Open this example in a new tab: Button secondary, solid background with icon at start, small

Code

Markup

<button class="nhsuk-button nhsuk-button--secondary-solid nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content">Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  variant: "secondary-solid",
  icon: {
    name: "arrow-left",
    placement: "start"
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-button__content">Next</span>
  <svg class="nhsuk-icon nhsuk-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="m14.7 6.3 5 5c.2.2.3.4.3.7 0 .3-.1.5-.3.7l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3H5a1 1 0 0 1 0-2h11.6l-3.3-3.3a1 1 0 1 1 1.4-1.4Z"/>
  </svg>
</button>

Macro

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

{{ button({
  text: "Next",
  variant: "secondary",
  icon: {
    name: "arrow-right",
    placement: "end"
  }
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-button__content">Next</span>
  <svg class="nhsuk-icon nhsuk-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="m14.7 6.3 5 5c.2.2.3.4.3.7 0 .3-.1.5-.3.7l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3H5a1 1 0 0 1 0-2h11.6l-3.3-3.3a1 1 0 1 1 1.4-1.4Z"/>
  </svg>
</button>

Macro

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

{{ button({
  text: "Next",
  variant: "secondary",
  icon: {
    name: "arrow-right",
    placement: "end"
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content">Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  variant: "secondary",
  icon: {
    name: "arrow-left",
    placement: "start"
  }
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content">Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  variant: "secondary",
  icon: {
    name: "arrow-left",
    placement: "start"
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--warning" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-u-visually-hidden">Warning: </span>Yes, delete this vaccine
</button>

Macro

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

{{ button({
  text: "Yes, delete this vaccine",
  variant: "warning"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--warning" data-module="nhsuk-button" type="submit" disabled aria-disabled="true">
  <span class="nhsuk-u-visually-hidden">Warning: </span>Yes, delete this vaccine
</button>

Macro

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

{{ button({
  text: "Yes, delete this vaccine",
  variant: "warning",
  disabled: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--warning nhsuk-button--small" data-module="nhsuk-button" type="submit" disabled aria-disabled="true">
  <span class="nhsuk-u-visually-hidden">Warning: </span>Yes, delete this vaccine
</button>

Macro

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

{{ button({
  text: "Yes, delete this vaccine",
  variant: "warning",
  small: true,
  disabled: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--warning" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-u-visually-hidden">Warning: </span>Continue
</button>

Macro

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

{{ button({
  text: "Continue",
  variant: "brand",
  classes: "nhsuk-button--warning"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--warning nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-u-visually-hidden">Warning: </span>Yes, delete this vaccine
</button>

Macro

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

{{ button({
  text: "Yes, delete this vaccine",
  small: true,
  variant: "warning"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--warning nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-button__content"><span class="nhsuk-u-visually-hidden">Warning: </span>Next</span>
  <svg class="nhsuk-icon nhsuk-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="m14.7 6.3 5 5c.2.2.3.4.3.7 0 .3-.1.5-.3.7l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3H5a1 1 0 0 1 0-2h11.6l-3.3-3.3a1 1 0 1 1 1.4-1.4Z"/>
  </svg>
</button>

Macro

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

{{ button({
  text: "Next",
  variant: "warning",
  icon: {
    name: "arrow-right",
    placement: "end"
  }
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--warning nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-button__content"><span class="nhsuk-u-visually-hidden">Warning: </span>Next</span>
  <svg class="nhsuk-icon nhsuk-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="m14.7 6.3 5 5c.2.2.3.4.3.7 0 .3-.1.5-.3.7l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3H5a1 1 0 0 1 0-2h11.6l-3.3-3.3a1 1 0 1 1 1.4-1.4Z"/>
  </svg>
</button>

Macro

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

{{ button({
  text: "Next",
  variant: "warning",
  icon: {
    name: "arrow-right",
    placement: "end"
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--warning nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content"><span class="nhsuk-u-visually-hidden">Warning: </span>Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  variant: "warning",
  icon: {
    name: "arrow-left",
    placement: "start"
  }
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--warning nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content"><span class="nhsuk-u-visually-hidden">Warning: </span>Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  variant: "warning",
  icon: {
    name: "arrow-left",
    placement: "start"
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-link" data-module="nhsuk-button" type="submit">
  Link as a button
</button>

Macro

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

{{ button({
  text: "Link as a button",
  className: "nhsuk-link"
}) }}
Code

Markup

<button class="nhsuk-button" data-module="nhsuk-button" data-prevent-double-click="false" type="submit">
  Save and continue
</button>

Macro

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

{{ button({
  text: "Save and continue",
  preventDoubleClick: false
}) }}
Code

Markup

<button class="nhsuk-button" data-module="nhsuk-button" data-prevent-double-click="true" type="submit">
  Save and continue
</button>

Macro

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

{{ button({
  text: "Save and continue",
  preventDoubleClick: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--plus" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M13.5 5.5a1.5 1.5 0 0 0-3 0v5h-5a1.5 1.5 0 0 0 0 3h5v5a1.5 1.5 0 0 0 3 0v-5h5a1.5 1.5 0 0 0 0-3h-5v-5Z"/>
  </svg>
  <span class="nhsuk-button__content">Increase</span>
</button>

Macro

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

{{ button({
  text: "Increase",
  icon: "plus"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-button__content">Next</span>
  <svg class="nhsuk-icon nhsuk-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="m14.7 6.3 5 5c.2.2.3.4.3.7 0 .3-.1.5-.3.7l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3H5a1 1 0 0 1 0-2h11.6l-3.3-3.3a1 1 0 1 1 1.4-1.4Z"/>
  </svg>
</button>

Macro

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

{{ button({
  text: "Next",
  icon: {
    name: "arrow-right",
    placement: "end"
  }
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-button__content">Next</span>
  <svg class="nhsuk-icon nhsuk-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="m14.7 6.3 5 5c.2.2.3.4.3.7 0 .3-.1.5-.3.7l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3H5a1 1 0 0 1 0-2h11.6l-3.3-3.3a1 1 0 1 1 1.4-1.4Z"/>
  </svg>
</button>

Macro

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

{{ button({
  text: "Next",
  icon: {
    name: "arrow-right",
    placement: "end"
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content">Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  icon: {
    name: "arrow-left",
    placement: "start"
  }
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content"><span class="nhsuk-u-visually-hidden">Important: </span>Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  visuallyHiddenText: "Important",
  icon: {
    name: "arrow-left",
    placement: "start"
  }
}) }}

Button with icon at start and visually hidden text, small

Open this example in a new tab: Button with icon at start and visually hidden text, small

Code

Markup

<button class="nhsuk-button nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content"><span class="nhsuk-u-visually-hidden">Important: </span>Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  visuallyHiddenText: "Important",
  icon: {
    name: "arrow-left",
    placement: "start"
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M10.7 6.3c.4.4.4 1 0 1.4L7.4 11H19a1 1 0 0 1 0 2H7.4l3.3 3.3c.4.4.4 1 0 1.4a1 1 0 0 1-1.4 0l-5-5A1 1 0 0 1 4 12c0-.3.1-.5.3-.7l5-5a1 1 0 0 1 1.4 0Z"/>
  </svg>
  <span class="nhsuk-button__content">Previous</span>
</button>

Macro

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

{{ button({
  text: "Previous",
  icon: {
    name: "arrow-left",
    placement: "start"
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--icon" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--plus" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M13.5 5.5a1.5 1.5 0 0 0-3 0v5h-5a1.5 1.5 0 0 0 0 3h5v5a1.5 1.5 0 0 0 3 0v-5h5a1.5 1.5 0 0 0 0-3h-5v-5Z"/>
  </svg>
  <span class="nhsuk-button__content">Increase</span>
</button>

Macro

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

{{ button({
  text: "Increase",
  icon: {
    html: '<svg class="nhsuk-icon nhsuk-icon--plus" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">\n  <path d="M13.5 5.5a1.5 1.5 0 0 0-3 0v5h-5a1.5 1.5 0 0 0 0 3h5v5a1.5 1.5 0 0 0 3 0v-5h5a1.5 1.5 0 0 0 0-3h-5v-5Z"/>\n</svg>\n'
  }
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--icon" data-module="nhsuk-button" type="submit" aria-label="Increase">
  <svg class="nhsuk-icon nhsuk-icon--plus" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M13.5 5.5a1.5 1.5 0 0 0-3 0v5h-5a1.5 1.5 0 0 0 0 3h5v5a1.5 1.5 0 0 0 3 0v-5h5a1.5 1.5 0 0 0 0-3h-5v-5Z"/>
  </svg>
</button>

Macro

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

{{ button({
  ariaLabel: "Increase",
  icon: {
    html: '<svg class="nhsuk-icon nhsuk-icon--plus" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">\n  <path d="M13.5 5.5a1.5 1.5 0 0 0-3 0v5h-5a1.5 1.5 0 0 0 0 3h5v5a1.5 1.5 0 0 0 3 0v-5h5a1.5 1.5 0 0 0 0-3h-5v-5Z"/>\n</svg>\n'
  }
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit" aria-label="Increase">
  <svg class="nhsuk-icon nhsuk-icon--plus" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M13.5 5.5a1.5 1.5 0 0 0-3 0v5h-5a1.5 1.5 0 0 0 0 3h5v5a1.5 1.5 0 0 0 3 0v-5h5a1.5 1.5 0 0 0 0-3h-5v-5Z"/>
  </svg>
</button>

Macro

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

{{ button({
  ariaLabel: "Increase",
  icon: {
    html: '<svg class="nhsuk-icon nhsuk-icon--plus" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">\n  <path d="M13.5 5.5a1.5 1.5 0 0 0-3 0v5h-5a1.5 1.5 0 0 0 0 3h5v5a1.5 1.5 0 0 0 3 0v-5h5a1.5 1.5 0 0 0 0-3h-5v-5Z"/>\n</svg>\n'
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--plus" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M13.5 5.5a1.5 1.5 0 0 0-3 0v5h-5a1.5 1.5 0 0 0 0 3h5v5a1.5 1.5 0 0 0 3 0v-5h5a1.5 1.5 0 0 0 0-3h-5v-5Z"/>
  </svg>
  <span class="nhsuk-button__content">Increase</span>
</button>

Macro

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

{{ button({
  text: "Increase",
  icon: {
    html: '<svg class="nhsuk-icon nhsuk-icon--plus" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">\n  <path d="M13.5 5.5a1.5 1.5 0 0 0-3 0v5h-5a1.5 1.5 0 0 0 0 3h5v5a1.5 1.5 0 0 0 3 0v-5h5a1.5 1.5 0 0 0 0-3h-5v-5Z"/>\n</svg>\n'
  },
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--icon" data-module="nhsuk-button" type="submit" aria-label="Increase">
  <svg class="nhsuk-icon nhsuk-icon--plus" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M13.5 5.5a1.5 1.5 0 0 0-3 0v5h-5a1.5 1.5 0 0 0 0 3h5v5a1.5 1.5 0 0 0 3 0v-5h5a1.5 1.5 0 0 0 0-3h-5v-5Z"/>
  </svg>
</button>

Macro

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

{{ button({
  ariaLabel: "Increase",
  icon: "plus"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit" aria-label="Increase">
  <svg class="nhsuk-icon nhsuk-icon--plus" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M13.5 5.5a1.5 1.5 0 0 0-3 0v5h-5a1.5 1.5 0 0 0 0 3h5v5a1.5 1.5 0 0 0 3 0v-5h5a1.5 1.5 0 0 0 0-3h-5v-5Z"/>
  </svg>
</button>

Macro

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

{{ button({
  ariaLabel: "Increase",
  icon: "plus",
  small: true
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--icon nhsuk-button--small" data-module="nhsuk-button" type="submit">
  <svg class="nhsuk-icon nhsuk-icon--plus" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" focusable="false" aria-hidden="true">
    <path d="M13.5 5.5a1.5 1.5 0 0 0-3 0v5h-5a1.5 1.5 0 0 0 0 3h5v5a1.5 1.5 0 0 0 3 0v-5h5a1.5 1.5 0 0 0 0-3h-5v-5Z"/>
  </svg>
  <span class="nhsuk-button__content">Increase</span>
</button>

Macro

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

{{ button({
  text: "Increase",
  icon: "plus",
  small: true
}) }}
Code

Markup

<button data-module="nhsuk-button" type="submit">
  Default button
</button>

Macro

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

{{ button({
  text: "Default button",
  className: false
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--small" data-module="nhsuk-button" type="submit">
  Save and continue
</button>

Macro

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

{{ button({
  text: "Save and continue",
  classes: "nhsuk-button--small"
}) }}
Code

Markup

<button class="nhsuk-button nhsuk-button--small" data-module="nhsuk-button" type="submit">
  Save and continue
</button>

Macro

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

{{ button({
  text: "Save and continue",
  classes: "nhsuk-button--small",
  small: true
}) }}
Code

Markup

<button class="nhsuk-button" data-module="nhsuk-button" type="submit">
  <span class="nhsuk-u-visually-hidden">Important: </span>Update
</button>

Macro

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

{{ button({
  text: "Update",
  visuallyHiddenText: "Important"
}) }}