Subnavigation
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; authors should avoid slotting bare <a> elements, which
are deprecated. 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.
Edit element properties
import '@rhds/elements/rh-subnav/rh-subnav.js';
<rh-subnav>
<a href="#">Users</a>
<a href="#">Containers</a>
<a href="#">Databases</a>
<a href="#" aria-current="page">Servers</a>
<a href="#">System</a>
<a href="#">Network</a>
<a href="#">Cloud</a>
</rh-subnav>
<link rel="stylesheet" href="../rh-subnav-lightdom.css">
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>
<a href="#">Users</a>
<a href="#">Containers</a>
<a href="#">Databases</a>
<a href="#" aria-current="page">Servers</a>
<a href="#">System</a>
<a href="#">Network</a>
<a href="#">Cloud</a>
</Subnav>
<link rel="stylesheet" href="../rh-subnav-lightdom.css" />
);
Sets color palette, which affects the element's styles as well as descendants' color theme. Overrides parent color context. Your theme will influence these colors so check there first if you are seeing inconsistencies. See CSS Custom Properties for default values
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.