Layout
Sidebar
Vertical navigation container with section support.
Built-in Link Support
Pass href and linkComponent directly on SidebarItem — no wrapper needed. Works with any router (Next.js, React Router, plain anchors).
Multiple Sections
Group items into labelled sections by passing multiple objects in the links array. Each section renders a SidebarSection heading automatically.
Nested Sub-Items
Add subItems to any item for nested navigation. On desktop they appear as a right-side popover; on mobile they expand as an accordion. Sub-items support href, linkComponent, icon, badge, and onClick.
Responsive Bottom Nav
At ≤ 900 px the sidebar automatically hides and renders a macOS dock-style bottom nav from items that have a navId. Items without navId stay sidebar-only. Pass autoNav={false} to opt out.
Properties
| Prop | Type | Default | Description |
|---|---|---|---|
links | SidebarLinkSection[] | — | Declarative nav config. Pass sections with items and Sidebar renders everything — headings, icons, badges, sub-items, links. |
linkComponent | React.ElementType | — | Default link component for all items (e.g. Next.js Link). Can be overridden per item via item.linkComponent. |
width | number | string | 240 | Sidebar width in pixels or any CSS unit. |
fixed | boolean | — | Renders the sidebar as position: fixed. |
stickyTop | number | string | — | Top offset when using fixed layout (e.g. "58px" to clear a navbar). |
isOpen | boolean | — | Controls the mobile drawer open state. |
onOpen | () => void | — | Called when the user swipes to open the mobile drawer. |
onClose | () => void | — | Called when the user closes the mobile drawer. |
autoNav | boolean | true | At ≤ 900 px the sidebar hides and a dock-style bottom nav renders automatically. Set false to opt out. |
activeId | string | — | The navId of the currently active item. Keeps the bottom nav icon lit correctly. |
onNavChange | (id: string) => void | — | Called when the user taps an item in the bottom nav. Use it to push the correct route. |
showNavLabels | boolean | true | Show text labels under icons in the bottom nav. |
children | React.ReactNode | — | Optional composed children (SidebarHeader, SidebarFooter, etc.). Rendered after links sections. |
item.label | React.ReactNode | — | (SidebarLinkItem) The item label text. |
item.href | string | — | (SidebarLinkItem) URL to navigate to when clicked. |
item.linkComponent | React.ElementType | — | (SidebarLinkItem) Per-item link component override. Defaults to the Sidebar-level linkComponent. |
item.icon | React.ReactNode | — | (SidebarLinkItem) Icon displayed before the label. |
item.activeIcon | React.ReactNode | — | (SidebarLinkItem) Alternate icon for the active state. |
item.badge | React.ReactNode | — | (SidebarLinkItem) Badge displayed after the label. |
item.active | boolean | — | (SidebarLinkItem) Highlights the item as the current active route. |
item.navId | string | — | (SidebarLinkItem) Registers this item in the auto bottom nav. Items without navId are sidebar-only. |
item.subItems | SidebarLinkSubItem[] | — | (SidebarLinkItem) Nested items — accordion on mobile, popover on desktop. Each supports href, linkComponent, label, icon, badge, active, onClick. |
item.onClick | (e: React.MouseEvent) => void | — | (SidebarLinkItem) Click handler. Fires even when href is set. |