Skip to Content
Puzzle

Collapsable Sidebar

Vertical icon navigation that expands inline or over adjacent content on desktop and mobile.

Import

import { CollapsableSidebar } from "@puzzle-ui/ui";

Groups and expansion

The sidebar starts collapsed. Its toggle expands labels and group headings. Navigation stays vertical on mobile, with the same toggle and groups as desktop. Expanded labels wrap to fit the available width.

Use expand="inline" to reserve the expanded width in the layout, or expand="over" to keep a compact rail while the navigation overlays adjacent content.

390 × 500

API

PropTypeDefaultDescription
itemsCollapsableSidebarEntry[]RequiredItems or labelled groups.
expand"inline" | "over""inline"Reserve space or overlay when expanded.
collapsedboolean-Controlled collapsed state.
defaultCollapsedbooleantrueInitial uncontrolled state.
onCollapsedChange(collapsed: boolean) => void-Expansion callback.
ariaLabelstring"Main navigation"Navigation name.
className, stylestring, CSSProperties-Root styling.

Items require id, icon, label, and either href or onClick; active marks the current item. Groups require id and items, with an optional label. Use stable IDs. Current links receive aria-current; icons are decorative.

;