Navigation (secondary)
On this page
Importing
Add rh-navigation-secondary to your page with this import statement:
<script type="module">
import '@rhds/elements/rh-navigation-secondary/rh-navigation-secondary.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
To learn more about installing RHDS elements on your site using an import map read our getting started docs.
Lightdom CSS
This element requires you to load "Lightdom CSS" stylesheets for styling deeply slotted elements.
Note
Replace /path/to/ with path to the CSS file, whether local or CDN.
<link rel="stylesheet" href="/path/to/rh-navigation-secondary/rh-navigation-secondary-lightdom.css">
Usage
<rh-navigation-secondary>
<a href="#" slot="logo" id="logo-id" aria-current="page">
Logo/Title
</a>
<ul slot="nav" aria-labelledby="logo-id">
<li>
<rh-navigation-secondary-dropdown>
<a href="#dropdown-fallback-url" slot="link">Dropdown</a>
<rh-navigation-secondary-menu slot="menu">
<rh-navigation-secondary-menu-section>
<h3 slot="header">Section</h3>
<ul slot="links">
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
<rh-cta slot="cta" href="#">Section CTA</rh-cta>
</rh-navigation-secondary-menu-section>
<rh-navigation-secondary-menu-section>
<h3 slot="header">Section</h3>
<ul slot="links">
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
<rh-cta slot="cta" href="#">Section CTA</rh-cta>
</rh-navigation-secondary-menu-section>
</rh-navigation-secondary-menu>
</rh-navigation-secondary-dropdown>
</li>
<li>
<rh-navigation-secondary-dropdown>
<a href="#dropdown-fallback-url" slot="link">Dropdown</a>
<rh-navigation-secondary-menu slot="menu">
<ul>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
</rh-navigation-secondary-menu>
</rh-navigation-secondary-dropdown>
</li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
<rh-cta slot="cta" href="#">Call to Action</rh-cta>
</rh-navigation-secondary>
<link rel="stylesheet" href="../rh-navigation-secondary-lightdom.css">
<script type="module">
import '@rhds/elements/rh-navigation-secondary/rh-navigation-secondary.js';
import '@rhds/elements/rh-cta/rh-cta.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
System Integration
Current page indicator
When a user is viewing a page that is part of the secondary navigation information architecture, a red top border is visible. If the current active page is part of a dropdown menu, that dropdown is highlighted with the same top border to indicate it contains the current page. For more details on how to use this current page indicator, refer to the design guidelines for current page indicator.
To enable this indicator style, implementation should apply the
aria-current="page" attribute to the current page link.
<a href="/" aria-current="page">Current page being viewed</a>
The rh-navigation-secondary element does not apply the
aria-current="page" attribute itself. The responsibility for
keeping track of which link is currently active falls on the content management
system or application. The element checks for the presence of this attribute
and applies the current page indicator style to nav links and dropdown menus
when the active page is within a dropdown menu.
rh-navigation-secondary
Persistent wayfinding navigation for linking related pages below
<rh-navigation-primary>. Provides role="navigation" with a
configurable aria-label and light/dark color palettes. On mobile,
items collapse behind a menu button. Keyboard navigation with Tab, Escape,
Enter/Space. Should contain logo, nav (<ul>), and optional
cta slots. Avoid using more then 5 nav items.
Slots
4
| Slot Name | Summary | Description |
|---|---|---|
product logo or name link |
Expects an |
|
mobile menu button label |
Text label for the mobile hamburger menu button. Defaults to "Menu". USE this slot for localization/translation of the button text. Screen readers announce this label with the button's expanded state. |
|
navigation link list |
Expects a |
|
navigation-level call to action |
Optional slot for an |
Attributes
2
| Attribute | DOM Property | Description | Type | Default |
|---|---|---|---|---|
|
|
colorPalette |
Controls the visual color palette of the navigation bar. Valid values:
|
|
|
|
|
accessibleLabel |
Sets the |
|
|
Methods
3
| Method Name | Description |
|---|---|
|
|
|
|
|
Opens a specific dropdown based on index. Closes all open dropdowns before opening specified. Toggles overlay to open |
|
|
Closes all open dropdowns |
Events
1
| Event Name | Description |
|---|---|
|
|
Fires when a dropdown opens/closes
in desktop view or mobile menu toggles. Detail: |
CSS Shadow Parts
3
| Part Name | Summary | Description |
|---|---|---|
|
|
main navigation wrapper element |
The outermost container for the secondary navigation, wrapping all navigation content
including logo, menu, and CTA. This part corresponds to a Styling:
|
|
|
navigation content container |
The primary container for navigation links, logo, mobile menu button, and CTA.
This part corresponds to a Styling:
|
|
|
call-to-action container |
Container for the navigation-level call-to-action button. This part corresponds
to a Styling:
|
CSS Custom Properties
1
| CSS Property | Description | Default |
|---|---|---|
--rh-navigation-secondary-z-index |
--rh-navigation-secondary-z-index Controls the stacking order of the secondary navigation bar. Defaults to 102 to ensure navigation appears above most page content but below modals and overlays. Usage guidelines:
z-index of the navigation-secondary Navigation container stacking order |
102
|
Design Tokens
16
| Token | Description | Copy |
|---|---|---|
--rh-color-text-primary
|
Navigation dropdown chevron color Navigation menu toggle color |
|
--rh-color-brand-red
|
Navigation current active item border color |
|
--rh-color-surface-lighter
|
Navigation bar surface in light mode Tertiary surface (light theme) |
|
--rh-color-surface-dark
|
Navigation bar surface in dark mode Tertiary surface (dark theme) |
|
--rh-border-width-sm
|
Navigation bar bottom border width 1px border width; Example: Secondary CTA or Button |
|
--rh-font-family-body-text
|
Navigation menu toggle typeface Body text font family |
|
--rh-font-size-body-text-md
|
Navigation menu toggle text size 16px font size |
|
--rh-border-width-lg
|
Navigation menu toggle top border width 3px border width: Example: Expanded Accordion panel |
|
--rh-space-lg
|
Navigation bar column gap Navigation menu expanded inline-end padding Navigation menu expanded inline-start padding Navigation menu toggle inner spacing Navigation menu toggle inline-end margin 16px spacer |
|
--rh-space-md
|
Navigation menu toggle content gap 8px spacer |
|
--rh-color-surface
|
Navigation menu toggle background |
|
--rh-color-surface-lightest
|
Primary surface (light theme) |
|
--rh-color-text-brand-on-light
|
Navigation menu toggle top accent color Navigation menu toggle top accent color Brand text color for light theme |
|
--rh-color-text-primary-on-dark
|
Primary text color for dark theme |
|
--rh-color-text-primary-on-light
|
Primary text color for light theme |
|
--rh-space-2xl
|
Navigation menu expanded top padding Navigation menu toggle inline-end margin at viewport >= md Navigation menu expanded top padding at viewport >= md Navigation menu expanded inline padding at viewport >= md Navigation call to action inner spacing at viewport >= md 32px spacer |
|
rh-navigation-secondary-dropdown
Wraps a top-level nav link to add expandable dropdown menu functionality.
Upgrades the slotted <a> with role="button", aria-expanded, and
aria-controls for accessibility. Highlights with a red top border when
the dropdown contains the current page (aria-current="page"). Keyboard:
Enter/Space toggles the dropdown; Tab moves through menu items; Escape
closes. Must contain an <a> in the link slot and an
<rh-navigation-secondary-menu> in the menu slot.
Slots
2
| Slot Name | Summary | Description |
|---|---|---|
dropdown trigger link |
Expects an |
|
dropdown menu panel |
Expects an |
Attributes
0
None
Methods
0
None
Events
1
| Event Name | Description |
|---|---|
|
|
Fires when the dropdown link is
clicked. Detail: |
CSS Shadow Parts
1
| Part Name | Summary | Description |
|---|---|---|
|
|
dropdown wrapper container |
The container for a navigation dropdown item, wrapping both the link and menu.
This part corresponds to a Styling:
|
CSS Custom Properties
0
None
Design Tokens
10
| Token | Description | Copy |
|---|---|---|
--rh-border-width-lg
|
Navigation dropdown leading border width 3px border width: Example: Expanded Accordion panel |
|
--rh-border-width-sm
|
Navigation dropdown trailing border width 1px border width; Example: Secondary CTA or Button |
|
--rh-color-border-subtle-on-light
|
Navigation dropdown trailing border color Subtle border color (light theme) |
|
--rh-box-shadow-sm
|
Navigation dropdown elevation shadow Small box shadow |
|
--rh-color-text-primary
|
Navigation dropdown chevron color |
|
--rh-font-size-body-text-md
|
16px font size |
|
--rh-color-surface
|
Navigation dropdown link slot background |
|
--rh-color-text-brand-on-light
|
Navigation dropdown leading border color Navigation dropdown expanded block-start accent color at viewport >= lg Brand text color for light theme |
|
--rh-color-surface-lightest
|
Navigation dropdown expanded background at viewport >= lg Primary surface (light theme) |
|
--rh-color-text-primary-on-light
|
Navigation dropdown expanded chevron color at viewport >= lg Primary text color for light theme |
|
rh-navigation-secondary-menu-section
Groups related links under a heading within a dropdown menu. Automatically
wires aria-labelledby between the slotted heading and adjacent <ul>/<ol>
for screen reader navigation. Renders as a <section> element. Must contain
a heading in the header slot and a list in the links slot. Should
provide an id on the heading or one will be auto-generated. Tab navigates
through links; the heading provides group context to assistive technology.
Slots
3
| Slot Name | Summary | Description |
|---|---|---|
section heading |
Expects an |
|
section link list |
Expects a |
|
section-level call to action |
Optional slot for an |
Attributes
0
None
Methods
0
None
Events
0
None
CSS Shadow Parts
1
| Part Name | Summary | Description |
|---|---|---|
|
|
menu section container |
The semantic container for a menu section, grouping related navigation links
under a common header. This part corresponds to a Styling:
Accessibility:
|
CSS Custom Properties
0
None
Design Tokens
3
| Token | Description | Copy |
|---|---|---|
--rh-font-family-heading
|
Navigation menu section typeface Heading font family |
|
--rh-font-size-body-text-md
|
Navigation menu section slotted list content gap 16px font size |
|
--rh-space-xl
|
Menu section CTA top spacing Menu section CTA block spacing 24px spacer |
|
rh-navigation-secondary-menu
Expandable dropdown menu panel for secondary navigation. Provides
full-width (default) and fixed-width layouts with content
organized in a CSS grid. Must be placed inside the menu slot of
an <rh-navigation-secondary-dropdown>. Tab navigates through
menu content; Escape closes the menu. Screen readers access
content via section headings and aria-labelledby associations.
Slots
1
| Slot Name | Summary | Description |
|---|---|---|
menu content |
Should contain |
Attributes
3
| Attribute | DOM Property | Description | Type | Default |
|---|---|---|---|---|
|
|
colorPalette |
Color palette for the menu panel surface. Should remain |
|
|
|
|
layout |
Controls the menu panel width. |
|
|
|
|
visible |
Controls whether the menu panel is visible. Managed automatically by the
parent |
|
|
Methods
0
None
Events
0
None
CSS Shadow Parts
3
| Part Name | Summary | Description |
|---|---|---|
|
|
container - |
|
|
|
container - |
|
|
|
container - |
CSS Custom Properties
3
| CSS Property | Description | Default |
|---|---|---|
--rh-navigation-secondary-menu-section-grid |
repeat(auto-fit,
minmax(15.5rem, 1fr))
|
|
--rh-navigation-secondary-menu-section-grid-gap |
Menu section grid gap override |
var(--rh-space-2xl, 32px)
|
--rh-navigation-secondary-menu-content-max-width |
Navigation maximum width at viewport >= lg |
1136px
|
Design Tokens
8
| Token | Description | Copy |
|---|---|---|
--rh-color-text-primary-on-light
|
Navigation menu dropdown text color Primary text color for light theme |
|
--rh-color-surface-lightest
|
Navigation menu dropdown background Primary surface (light theme) |
|
--rh-space-xl
|
Navigation menu sections inner spacing 24px spacer |
|
--rh-font-size-body-text-md
|
Navigation menu slotted list content gap 16px font size |
|
--rh-box-shadow-sm
|
Navigation menu elevation shadow at viewport >= lg Small box shadow |
|
--rh-space-2xl
|
Menu section grid gap Navigation menu inline padding at viewport >= lg Navigation menu inline padding at viewport >= xl 32px spacer |
|
--rh-space-3xl
|
Navigation menu block-end padding at viewport >= lg Navigation menu block padding at viewport >= xl Navigation menu block padding at viewport >= 2xl 48px spacer |
|
--rh-space-4xl
|
Navigation menu block-start padding at viewport >= lg Navigation menu inline padding at viewport >= 2xl 64px spacer |
|
rh-navigation-secondary-overlay
Semi-transparent backdrop for dimming page content when a secondary
navigation dropdown or mobile menu is expanded. Provides a click
target that allows users to close all open menus. Managed
automatically by <rh-navigation-secondary>; avoid using
standalone. Screen readers should ignore this element as it serves
a purely visual purpose. Keyboard: Escape closes the overlay.
Slots
0
Attributes
1
| Attribute | DOM Property | Description | Type | Default |
|---|---|---|---|---|
|
|
open |
When |
|
|
Methods
0
None
Events
0
None
CSS Shadow Parts
0
None
CSS Custom Properties
1
1
| CSS Property | Description | Default |
|---|---|---|
--rh-navigation-secondary-overlay-z-index |
Overlay stacking order |
var(--rh-secondary-nav-overlay-z-index, -1)
|
Deprecated CSS Custom Properties
| CSS Property | Description | Default | Reason |
|---|---|---|---|
--rh-secondary-nav-overlay-z-index |
-1 |
use --rh-navigation-secondary-overlay-z-index |
Design Tokens
2
| Token | Description | Copy |
|---|---|---|
--rh-color-gray-90
|
Overlay background base color Secondary surface (dark theme) |
|
--rh-opacity-80
|
Overlay background base color Overlay background opacity 80% opacity |
|
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.