Use back links to help users go back to the previous page in a multi-page transaction.
WCAG 2.2 affects this component
To meet new success criteria introduced in the Web Content Accessibility Guidelines (WCAG) 2.2, make sure that users can successfully:
- avoid re-entering information they've previously given when they go back to a page
- interact with back links
See the full list of design system changes to meet WCAG 2.2.
<div class="nhsuk-back-link">
<a class="nhsuk-back-link__link" href="#">
<svg class="nhsuk-icon nhsuk-icon__chevron-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" height="24" width="24">
<path d="M8.5 12c0-.3.1-.5.3-.7l5-5c.4-.4 1-.4 1.4 0s.4 1 0 1.4L10.9 12l4.3 4.3c.4.4.4 1 0 1.4s-1 .4-1.4 0l-5-5c-.2-.2-.3-.4-.3-.7z"></path>
</svg>
Go back</a>
</div>
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
Name | Type | Required | Description |
---|---|---|---|
text | string | false | Text to use within the back link component. If `html` is provided, the `text` argument will be ignored. Defaults to "Back". |
html | string | false | HTML to use within the back link component. If `html` is provided, the `text` argument will be ignored. Defaults to "Back". |
href | string | false | The value of the link href attribute. |
classes | string | false | Classes to add to the container. |
attributes | object | false | HTML attributes (for example data attributes) to add to the tag. |
element | string | false | Which html element to use to render the back link - `button` or `a`. If not provided, defaults to `a`. |
{% from 'back-link/macro.njk' import backLink %}
{{ backLink({
href: "#",
text: "Go back"
}) }}
When to use a back link
We only use back links on transactional services or multi-page forms.
The GOV.UK design system recommends including a back link on question pages. Read more about question pages on GOV.UK.
You can include a back link on other pages in a multi-page transaction, if it makes sense to do so.
When not to use a back link
Do not use a back link on a content page, like a health information page.
Do not use a back link with breadcrumbs.
How to use back links
Make sure the text used in the link describes the action, for example "Go back". Carry out research with users to find the words that help them the most.
The link should take users back to the page they were on in the state they last saw it.
If a user goes back to a previous page, make sure information they have already entered is pre-populated.
Do not pre-populate if the information is no longer valid, or when pre-populating would be a major safety or security concern. This is to comply with WCAG 2.2 success criterion 3.3.7 Redundant Entry (W3C).
Generally, the back link should go at the top left of the page. Within the HTML it should appear before the <main>
tag. This is so that skip link skips past the back link to the main content.
If you put the back link in a different position, do not put it close to other links or buttons where it might distract users from what they need to do. Also think about people who use a screen reader: is the page read out in a logical order?
Make sure no other interactive elements are too close to the back link so users can easily interact with it. This is to comply with WCAG 2.2 success criterion 2.5.8 Target Size (W3C).
Back link as a button
You can render the back link as a button
element if necessary in order to post form
data back to the previous page.
<div class="nhsuk-back-link">
<button class="nhsuk-back-link__link">
<svg class="nhsuk-icon nhsuk-icon__chevron-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" height="24" width="24">
<path d="M8.5 12c0-.3.1-.5.3-.7l5-5c.4-.4 1-.4 1.4 0s.4 1 0 1.4L10.9 12l4.3 4.3c.4.4.4 1 0 1.4s-1 .4-1.4 0l-5-5c-.2-.2-.3-.4-.3-.7z"></path>
</svg>
Go back</button>
</div>
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
Name | Type | Required | Description |
---|---|---|---|
text | string | false | Text to use within the back link component. If `html` is provided, the `text` argument will be ignored. Defaults to "Back". |
html | string | false | HTML to use within the back link component. If `html` is provided, the `text` argument will be ignored. Defaults to "Back". |
href | string | false | The value of the link href attribute. |
classes | string | false | Classes to add to the container. |
attributes | object | false | HTML attributes (for example data attributes) to add to the tag. |
element | string | false | Which html element to use to render the back link - `button` or `a`. If not provided, defaults to `a`. |
{% from 'back-link/macro.njk' import backLink %}
{{ backLink({
text: "Go back",
element: "button"
}) }}
Research
During testing, NHS 111 online found that some users wanted to change their answers, so they introduced a back link and labelled it to "Change my previous answer".
Help us improve this guidance
Share insights or feedback and take part in the discussion. We use GitHub as a collaboration space. All the information on it is open to the public.
Read more about how to feedback or share insights.
If you have any questions, get in touch with the service manual team.
Updated: September 2024