Subnavigation
>
Since v1.0.0
On this page
Overview
A subnavigation provides a horizontal list of links for navigating
related pages. Authors should slot <rh-navigation-link> elements as
children. Each link must have visible text content for accessibility.
When more than one subnav appears on a page, authors should set
accessible-label so screen readers can distinguish them.
Overflow scroll buttons appear when links exceed the available space. All links are keyboard accessible via Tab and Enter.
Also known as: Horizontal navigation
Edit element properties
import '@rhds/elements/rh-navigation-link/rh-navigation-link.js';
import '@rhds/elements/rh-subnav/rh-subnav.js';
<rh-subnav>
<rh-navigation-link href="#">Users</rh-navigation-link>
<rh-navigation-link href="#">Containers</rh-navigation-link>
<rh-navigation-link href="#">Databases</rh-navigation-link>
<rh-navigation-link href="#" current-page="">Servers</rh-navigation-link>
<rh-navigation-link href="#">System</rh-navigation-link>
<rh-navigation-link href="#">Network</rh-navigation-link>
<rh-navigation-link href="#">Cloud</rh-navigation-link>
</rh-subnav>
<link rel="stylesheet" href="../rh-subnav-lightdom.css">
import { NavigationLink } from "@rhds/elements/react/rh-navigation-link/rh-navigation-link.js";
import { Subnav } from "@rhds/elements/react/rh-subnav/rh-subnav.js";
// NOTE: React 19+ does not require these wrapper imports.
// You can use the custom elements directly as-is.
export const Demo = () => (
<Subnav>
<NavigationLink href="#">Users</NavigationLink>
<NavigationLink href="#">Containers</NavigationLink>
<NavigationLink href="#">Databases</NavigationLink>
<NavigationLink href="#" current-page>Servers</NavigationLink>
<NavigationLink href="#">System</NavigationLink>
<NavigationLink href="#">Network</NavigationLink>
<NavigationLink href="#">Cloud</NavigationLink>
</Subnav>
<link rel="stylesheet" href="../rh-subnav-lightdom.css" />
);
Customize the default aria-label on the <nav> container.
Defaults to "subnavigation" if no attribute/property is set.
Label for the scroll back button
Label for the scroll forward button
Status
- Figma library:
-
Ready - RH Elements:
-
Ready - RH Shared Libs:
-
Ready
When to use
- When you need to connect a group of related pages together
- When you need to offer users a more granular navigation
- When you want to allow users to browse high-level and low-level pages in the same experience
Status checklist
| Property | Status | Meaning |
|---|---|---|
| Figma library |
|
Component is available in the Figma library |
| RH Elements |
|
Component is available in RH Elements |
| RH Shared Libs |
|
Component is available in RH Shared Libs |
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.