Navigation Bar
Bottom navigation for phones, with three to five destinations. The phone sibling of the Navigation Rail: same items, same pill that grows from the center, same icons that fill in.
Install
npx shadcn@latest add @nelumbo/navigation-barStacked
The default: icon in a pill, label below, 64px tall plus the home-indicator inset. Badges show a count or a dot.
Good evening
Made for you
Recently played
New releases
Inline
Icon and label side by side, for wider windows such as a large phone in landscape.
Good evening
Made for you
Recently played
New releases
Rail or bar
Use the bar on compact windows and the rail from medium up. Both take the same items, so switching is a breakpoint.
const items = destinations.map((d) => ({ icon: d.icon, label: d.label, href: d.href, active: pathname === d.href }))<NavigationRail aria-label="Main" className="hidden md:flex"> {items.map((i) => <NavigationRailItem key={i.href} {...i} />)}</NavigationRail><NavigationBar aria-label="Main" className="md:hidden"> {items.map((i) => <NavigationBarItem key={i.href} {...i} />)}</NavigationBar>Usage
Pin it to the bottom of the viewport. If you use snackbars, give the host an offset so they clear the bar.
import { NavigationBar, NavigationBarItem } from "@/components/ui/navigation-bar"<NavigationBar aria-label="Main" className="fixed inset-x-0 bottom-0"> <NavigationBarItem asChild icon="home" label="Home" active={pathname === "/"}> <Link href="/" /> </NavigationBarItem> <NavigationBarItem href="/library" icon="library_music" label="Library" badge={3} /></NavigationBar><Snackbars offset={80} />Props
| Prop | Type | Default | Notes |
|---|---|---|---|
NavigationBar inline | boolean | false | Icon and label side by side |
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 href / asChild | string / boolean | Link instead of button | |
Item disabled | boolean | false |