Step by step navigation header
Shows that a content page is part of a step by step navigation
The component indicates to the user that the current page is part of a step by step navigation, and can provide a link to it.
How it looks (preview) (preview all)
How to call this component
<%= render "govuk_publishing_components/components/step_by_step_nav_header", {
title: "Learn to drive a car: step by step"
} %>
Accessibility acceptance criteria
The component is designed to go into the top of an existing content page. This component looks like a heading so uses a heading level 2 element.
An earlier version of the component did not use a heading element – this failed WCAG 2.1 Success Criterion 1.3.1 (“Information, structure, and relationships conveyed through presentation can be programmatically determined or are available in text.”)
An early version of the component contained a hidden skip link for keyboard and screen reader users, that jumped to the step by step navigation component in the sidebar (similar to the ‘skip to content’ link at the top of all GOV.UK pages). User testing suggested that rather than helping users it confused them, so this has been removed.
Always place the step by step navigation header at the top of a page, before the <main>
element. Placing the component here means that the “Skip to main content” link allows the user to skip all navigation links, including the step by step navigation header.
Links in the component must:
- accept focus
- be focusable with a keyboard
- be usable with a keyboard
- indicate when they have focus
- change in appearance when touched (in the touch-down state)
- change in appearance when hovered
- be usable with touch
- be usable with voice commands
- have visible text
- have meaningful text
Other examples
Standard options
This component uses the component wrapper helper. It accepts the following options and applies them to the parent element of the component. See the component wrapper helper documentation for more detail.
id
- accepts a string for the element ID attributedata_attributes
- accepts a hash of data attributesaria
- accepts a hash of aria attributesclasses
- accepts a space separated string of classes, these should not be used for styling and must be prefixed withjs-
margin_bottom
- accepts a number from0
to9
(0px
to60px
) using the GOV.UK Frontend spacing scale (defaults to no margin)role
- accepts a space separated string of roleslang
- accepts a language attribute valueopen
- accepts an open attribute value (true or false)hidden
- accepts an empty string, ‘hidden’, or ‘until-found’tabindex
- accepts an integer. The integer can also be passed as a string.dir
- accepts ‘rtl’, ‘ltr’, or ‘auto’.
With a link (preview)
<%= render "govuk_publishing_components/components/step_by_step_nav_header", {
title: "Having children: step by step",
path: "/childcare-parenting/pregnancy-and-birth"
} %>
With a long text (preview)
<%= render "govuk_publishing_components/components/step_by_step_nav_header", {
title: "Coronavirus: businesses and self-employed people",
path: "/childcare-parenting/pregnancy-and-birth"
} %>
With margin bottom (preview)
The component accepts a number for margin bottom from 0
to 9
(0px
to 60px
) using the GOV.UK Frontend spacing scale. It defaults to having a margin bottom of 30px
.
<%= render "govuk_publishing_components/components/step_by_step_nav_header", {
title: "Learn to practice flexible spacing: step by step",
margin_bottom: 9
} %>
Without ga4 tracking (preview)
Disables GA4 tracking on the header. Tracking is enabled by default. This includes the ga4-link-tracker
module and data-ga4-link
attributes. See the ga4-link-tracker docs for more information.
<%= render "govuk_publishing_components/components/step_by_step_nav_header", {
disable_ga4: true,
title: "Learn to drive a motorbike: step by step",
path: "/learn-to-drive-a-motorbike"
} %>