Navigation Rail
Side navigation for tablets and desktops, with three to seven destinations. The active destination's pill grows out from the center and its icon fills in. Expand it and the labels slide in beside the icons.
Install
npx shadcn@latest add @nelumbo/navigation-railCollapsed and expanded
The menu button toggles between the 80px rail and the 220px expanded rail, where each destination is a compact 40px row. The FAB extends with it. Badges show a count or a dot; settings sit in the footer.
Inbox
12 unread conversations
With descriptions
Expanded rows are a compact 40px. Give an item a description and its row grows to 56px to fit the second line; it's hidden while collapsed.
Inbox
12 unread conversations
Rail only
Without the menu button, for layouts that never expand.
Inbox
12 unread conversations
Usage
Items are buttons with onClick, links with href, or your router's Link with asChild. The active item gets aria-current=page.
import { NavigationRail, NavigationRailHeader, NavigationRailItem, NavigationRailFooter } from "@/components/ui/navigation-rail"<NavigationRail aria-label="Main" expanded={open}> <NavigationRailHeader> <IconButton icon="menu" label="Menu" onClick={() => setOpen(!open)} /> <Fab icon="edit" label="Compose" extended={open} /> </NavigationRailHeader> <NavigationRailItem asChild icon="inbox" label="Inbox" badge={12} active={pathname === "/inbox"}> <Link href="/inbox" /> </NavigationRailItem> <NavigationRailItem href="/files" icon="folder" label="Files" /> <NavigationRailFooter> <NavigationRailItem href="/settings" icon="settings" label="Settings" /> </NavigationRailFooter></NavigationRail>Props
| Prop | Type | Default | Notes |
|---|---|---|---|
NavigationRail expanded | boolean | false | 80px or 220px wide |
Item icon / label | IconName / string | Required | |
Item active | boolean | false | Pill, filled icon, aria-current=page |
Item badge | number | boolean | A count (99+ max), or a dot | |
Item description | string | Second line when expanded; row grows from 40 to 56px | |
Item href / asChild | string / boolean | Link instead of button | |
Item disabled | boolean | false |