SideNav

Collapsible sidebar navigation with optional icons and one level of grouping

Category: navigation · WCAG 2.2-AA · navigation, sidebar, app-shell, collapsible

States

Props

PropTypeDefaultDescription
groupsSideNavGroup[]Grouped navigation items rendered under optional group labels.
showCollapseTogglebooleantrueShow the collapse/expand toggle control.
itemsSideNavItem[]{ label, href?, icon?, active?, items?, onClick?, disabled?, tone?, trailing?, render? } — an onClick-only item renders a focusable <button>; nested items render expandable menus (links, action sub-items with onSelect/selected, separators, labels); render() is an alignment-preserving escape hatch
collapsedbooleanControlled collapsed state (rail mode)
defaultCollapsedbooleanfalseWhether the rail is collapsed on first render (uncontrolled).
onCollapsedChange(collapsed: boolean) => voidCalled with the new collapsed state when it changes.
ariaLabelstringSide navigationAccessible label for the component.
collapseLabelstringCollapse navigationAccessible label for the collapse control.
expandLabelstringExpand navigationAccessible label for the expand control.
expandOnHoverbooleanfalseWidens the rail as an overlay on hover/focus-within; suppresses tooltips/flyouts
headerReactNodeContent rendered above the items, inside the item padding context (e.g. app-context pickers)
footerReactNodeContent rendered above the collapse toggle (e.g. version string, user info)
classNamestringAdditional CSS class names merged onto the root element.

Design tokens

When to use

When not to use

How to build an accessible SideNav in React →

Examples

Basic

<SideNav items={[{ label: 'Home', href: '/', active: true }, { label: 'Reports', href: '/reports' }]} />

With a group

<SideNav items={[{ label: 'Settings', items: [{ label: 'Profile', href: '/profile' }] }]} />

Icon rail

Collapsed rail: icons-only with tooltips, grapheme fallback for icon-less items, flyout menus for groups

import { Home } from '@cascivo/icons'

<SideNav collapsed items={[{ label: 'Home', href: '/', icon: <Home size={16} /> }]} />

Expand on hover

Rail widens as CSS overlay on hover without reflowing adjacent content

<SideNav collapsed expandOnHover items={items} />

Related components

← Back to docs