Sidebar navigation


Install
npx shadcn add @klarhimmel/app-shell-sidebarDetailsAbout, usage, props and more
The sidebar of an app: grouped links with icons and an optional count, groups that open and close, the current page marked with aria-current, and a button that folds it…
States
sidebar navigation in 2 forms: expanded, icon rail.
expanded
icon rail
Notes
When to use it
The side navigation of an app, with grouped links and a current page. Use app-shell-topbar with it for breadcrumbs and the account menu; a marketing site should use a navbar block, not this.
Writing for it
- Labels hold 30 characters, and the optional badge holds only 6, so write a count like 14 and not a word. - active must equal one item label exactly, or no link is marked as the current page. Keep labels unique across groups for the same reason. - Set collapsible: true only on groups that people may want to fold away, such as Manage. Up to 4 groups of 6 links keep the rail readable.
Watch out for
In the collapsed rail the labels become tooltips and the brand is hidden visually, and collapsible groups stop behaving as buttons. An item with an empty label is not drawn at all, so a blank link vanishes without a warning.
Pairs well with
Usage
The block in a page, with its default content (long lists shortened). Every prop is in the table below.
Props
The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.
| Prop | Type | Default | Description |
|---|---|---|---|
brand | string | 'Name the product' | Text, up to 30 characters. |
navLabel | string | 'Main navigation' | Text, up to 40 characters. |
groups | { label, collapsible, open, items }[] | 2 items | List of 1 to 4. Each item: label, collapsible, open, items. |
active | string | 'Second page' | Text, up to 30 characters. |
collapsed | boolean | false | See the type. |
toggle | { collapse, expand } | {…} | Fields: collapse, expand. |
Install
Installs
- Tooltip
- About
- The sidebar of an app: grouped links with icons and an optional count, groups that open and close, the current page marked with aria-current, and a button that folds it into an icon rail whose names appear in tooltips (on hover and…
- States
- Expanded and rail. Groups open and close; the current page has aria-current; the rail names every icon in a tooltip on hover and focus. New project? Set it up once: /get-started/installation.