Skip to content

Nav list

A sidebar's list of destinations, with sections, the current page and locked rows that say why.

NavigationSidebar
npx shadcn@latest add @silicon-ui/nav-list

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/nav-list

Manually

  1. Install the dependencies

    npm install motion
  2. Copy these files into your project

    • components/silicon-ui/nav-list/nav-list.tsx
    • components/silicon-ui/nav-list/nav-list.module.css

    Shared with other components. Skip any you already have.

    • components/silicon-ui/lib/menu-highlight.tsx
    • components/silicon-ui/lib/fluid-hover.tsx
    • components/silicon-ui/lib/silicon-provider.tsx
    • components/silicon-ui/lib/sidebar-rail.tsx
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { NavList } from "@/components/silicon-ui/nav-list/nav-list";

API reference

NavList

PropTypeDefault
label*

Names the navigation for screen readers, such as "Main" or "Settings".

string—
children*

NavItem and NavSection elements, in order.

ReactNode—
className

Placement only (width, margins, grid area); the rows' look comes from the component.

string—
ref

The `<nav>` element.

Ref<HTMLElement>—
onNavigate

Called when any row is chosen (click, Enter or Space; link and action rows), before it navigates or acts. A notification, such as closing a phone sheet: it cannot cancel. Locked rows and modified clicks (a new tab or window) do not call it.

(choice: NavChoice) => void—

NavSection

PropTypeDefault
label*

The section's heading, such as "Workspace".

string—
children*

The section's NavItem rows, or NavSections nested in it (an index: Components › Actions › Buttons).

ReactNode—
icon

A 16px icon before the heading.

ReactNode—
trailing

Content at the heading's end, such as how many rows it holds.

ReactNode—
collapsible

Makes the heading a row that opens and closes the section, with a chevron before it. A section holding the current page keeps its heading lit while closed. Rows in a collapsible section are indented under its heading.

boolean—
defaultOpen

Whether a collapsible section starts open. Defaults to true.

boolean—
open

Whether a collapsible section is open, to control it (with `onOpenChange`), such as opening every section while a search filters the rows.

boolean—
onOpenChange

Called when a collapsible section's heading opens or closes it.

(open: boolean) => void—

NavItem

PropTypeDefault
children*

The row's label.

ReactNode—
icon

A 16px icon before the label.

ReactNode—
active

The current page: sets aria-current="page" and the active marker.

booleanfalse
disabled

Turns the row off. It stays focusable (aria-disabled) so keyboard users can reach it and hear why.

booleanfalse
reason

Why the row is off, such as "Pro". Shown as a badge and read as the row's description. Only shown when disabled.

string—
trailing

Content at the row's end, such as a count or an avatar. Hidden while a reason shows.

ReactNode—
onIntent

Called each time the pointer enters the row or it receives focus, before it is chosen: start loading the destination (prefetch). It can fire more than once, so keep it idempotent. Not called while disabled.

() => void—
className

Placement only; the row's look comes from the component.

string—
hrefstring—
onSelectnever—

Dependencies

npm
motion
Registry
silicon-motion-tokensbadge