Navigation - Skip link

Use a skip link to help keyboard-only users skip to the main content on a page.

Open this default skip link example in a new tab
Copy default skip link code
<p class="nhsuk-body">To view the skip link, tab to this example, or click inside this example and press tab.</p>

<a class="nhsuk-skip-link" href="#maincontent">Skip to main content</a>
Close default skip link code
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.

Nunjucks arguments for default skip link
Name Type Required Description
text string false Text to use within the skip link component. Defaults to `Skip to main content` if you do not provide a value.
href string false The value of the skip link’s `href` attribute. Defaults to `#maincontent` if you do not provide a value.
classes string false Classes to add to the skip link.
attributes object false HTML attributes (for example data attributes) to add to the skip link.
Copy default skip link code
<p class="nhsuk-body">To view the skip link, tab to this example, or click inside this example and press tab.</p>

{% from 'skip-link/macro.njk' import skipLink %}

{{ skipLink({
  href: "#maincontent",
  text: "Skip to main content"
}) }}
Close default skip link code

When to use a skip link

All nhs.uk pages must include a skip link in the header following guidance in the GOV.UK Design System.

How skip links work

Some people use the tab key on their keyboard to navigate through the links and form elements on a web page. Including a skip link gives users the option to bypass the top-level navigation links and jump to the main content on the page.

The skip link component is visually hidden until a keyboard press activates it.

Research

If you’ve used skip links, please share your user research findings.

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: February 2019