Ask Rift AI
Theme: Smoke
Layout: Contained
Background: Field
Search or ask anythingAsk Rift AI
Theme: Smoke
Layout: Contained
Background: Field
Colour mode: System

Sub-nav panel

The second column of app navigation

A 240px column listing the pages inside one section, under a heading that names it. Items can sit under group headings, carry a count badge, and nest one level deep as an accordion. It works on its own, and it is the panel AppSidebar opens beside the rail when navigation runs to a third level.

Default

Flat rows with one accordion. Financial planning stays closed until it is pressed, and its rows hang from a tree line under the label.

Current page inside an accordion

When activeKey names a nested row, the accordion holding it starts open, so the reader lands with their place already showing. Close it and the parent row keeps the emphasis weight.

Groups and badges

Consecutive items that share a group render under one heading. A badge adds the same count pill the app sidebar uses.

Collapse control

Passing onCollapse adds a close control beside the heading. The panel reports the press; the host decides what showing and hiding it means.

Back row

Passing onBack adds a row above the heading that returns to the level above, for a host that drills into the panel as a screen of its own. The app sidebar’s phone drawer drills in on a drill menu instead. Press Menu, then Reports, to move between the two levels.

Props

Read from the same JSDoc that ships in the package's types. A required prop is marked with an asterisk.

SubNavPanel props
PropTypeDefaultDescription
items*
SubNavPanelItem[]
Items to list, optionally grouped with `group` and nested one level with `children`
title
string
Heading at the top of the panel, usually the label of the item that opened it. Also the panel's accessible name, after a native `aria-label`; with neither, the panel is named "Section navigation". Note: this shadows the native `title` tooltip attribute, which SubNavPanel does not expose.
activeKey
string
Key of the item for the current page. Its accordion parent starts open
defaultOpenKeys
string[]
Keys of the accordion rows open on first render, in addition to the active item's parent
onCollapse
(() => void)
Renders a collapse button beside the heading and calls this when it is pressed
collapseLabel
string
Accessible name of the collapse button. Defaults to "Collapse <title>", or "Collapse panel" when there is no title
onBack
(() => void)
Renders a back row above the heading and calls this when it is pressed, for a host that drills into the panel as a screen of its own
backLabel
string
'Back'
Label of the back row
className
string
''
Additional CSS classes
linkComponent
LinkComponent
The component its links render with, such as Next.js's `Link`, so they navigate through the app's router. Wins over a LinkProvider's; a plain `<a>` when neither is set.

Tested keys

An automated test presses every row below, in a left-to-right and a right-to-left layout.

The collapsible section follows the WAI-ARIA disclosure pattern.

Keys the collapsible section is tested against
KeyWhat it does
Enter
Opens what it controls, and closes it when it is open.
Space
Does the same as Enter.
tsx
// From the npm package
import { SubNavPanel } from 'rift-ds/components/SubNavPanel/SubNavPanel';

// Or as source you own, via the shadcn CLI
npx shadcn@latest add https://rift-ds.com/r/sub-nav-panel.json

6.3 kB gzipped, with everything it imports. Peer dependencies are not counted.

For agents: the props, their allowed values and defaults, and the tested keys, as markdown or as a JSON schema.