

Photo: Abbey Alabi
Nested Nav
Introduction
The nested navigation component provides a structured, multi-level sidebar navigation. It supports up to three levels of hierarchy, with indentation and font size communicating depth.
Nested Navigation
Add .nested-nav to a <ul> element. In Figure 1, the level-one link marks the active section, and the nested link marks the current page.
HTML
<nav>
<ul class="nested-nav"> <li> <a href="#">Overview</a> </li> <li> <a href="#" aria-current="true">American Robin</a> <ul> <li> <a href="#" aria-current="page">Nesting</a> </li> <li> <a href="#">Diet</a> </li> <li> <a href="#">Migration</a> </li> </ul> </li> <li> <a href="#">Eastern Bluebird</a> <ul> <li> <a href="#">Identification</a> <ul> <li> <a href="#">Plumage</a> </li> <li> <a href="#">Song</a> </li> </ul> </li> <li> <a href="#">Habitat</a> </li> </ul> </li> <li> <a href="#">Conservation</a> </li> <li> <a href="#">Resources</a> </li> </ul>
</nav>Related Custom Properties
Nested navigation styles can be customized by redefining the related CSS custom properties.
CSS
:root { --nav-nested-padding-x: var(--nav-divider-padding-x); --nav-nested-padding-y: 0.5em; --nav-nested-parent-font-size: var(--font-size-md); --nav-nested-child-font-size: var(--font-size-sm); --nav-nested-indicator-width: 3px; --nav-nested-indicator-color: currentColor;}| Custom property | Default | Purpose |
|---|---|---|
--nav-nested-padding-x | var(--nav-divider-padding-x) | Horizontal padding for navigation links at all levels. Level 2 and 3 multiply this value to create indentation. |
--nav-nested-padding-y | 0.5em | Vertical padding for navigation links. |
--nav-nested-parent-font-size | var(--font-size-md) | Font size for level-1 navigation links. |
--nav-nested-child-font-size | var(--font-size-sm) | Font size for level-2 and level-3 navigation links. |
--nav-nested-indicator-width | 3px | Width of the active indicator bar on level-1 items. |
--nav-nested-indicator-color | currentColor | Color of the active indicator bar. Defaults to currentColor. Override with a color token such as var(--color-primary). |
Read Next
Search Docs
Search documentation pages and page sections.
46 pages available.


Accordion

Alert

Aspect Ratio

Backdrop

Badge

Border

Breadcrumb

Breakpoint

Button

Card

Collapse

Color

Container

Customization

Display

Dropdown

Figma

Flex

Flyout

Form

Get Started

Gradient

Grid

Icon

Layer

Lightbox

Link

Main Menu

Modal

Navigation

Nested Nav

Opacity

Overflow

Pagination

Position

React

RTL

Shadow

Sizing

Spacing

Tab

Table

Track

Typography

Z-index
No results found for ''


