Show code Hide code
Usage
Side navigation displays a user's current position in the content hierarchy past the main navigation and enables them to move between sections and related content.
Guidance
- use single level navigation to show pages at the same level of the content hierarchy and allow users to navigate horizontally, such as for a stepped process or journey along a path
- use multiple level navigation so users can navigate vertically through the content hierarchy
- label the mobile navigation toggle with the current page title or section name to help users understand what content they're expanding.
- manually integrate side navigation into the main navigation structure (e.g. hamburger menu) on mobile and smaller viewports.
How this component works
Side navigation supports four levels of nesting along with an accompanying heading. For visual hierarchy, each level of nesting is indented.
When a parent section is selected, it expands to display the children. Parent sections remain bolded while the current selection is indicated by the active background colour.
Mobile behaviour and implementation
On mobile and smaller viewports, the side navigation component now includes an in-built mobile solution that allows the navigation to remain in its contextual location.
Enabling mobile functionality in existing side nav setups
To enable mobile toggle functionality on existing side navs:
- Add
js-side-navclass to the parent<div>element containing the side navigation. - Insert the toggle button as the first child inside the existing
.nsw-side-navelement. Ensure the button label reflects the page title where the side navigation appears: - Add
nsw-side-nav__contentclass to the main<ul>containing the navigation items. - Remove the
nsw-layout__sidebar--desktopclass from the parent<div>if you were previously using this method to hide the side navigation on desktop. If this class is not removed, the side nav may remain hidden at certain breakpoints, which can prevent the mobile toggle from appearing.
Accessibility
All components are responsive and designed to comply with WCAG 2.2 AA accessibility standards. Full compliance depends on using and configuring the components correctly.