Skip to content
HomeCobalt

Nav

Takes you between the app's sections, marking the one you are on, as a row of links at the top and as a bar of tabs along the bottom of a phone.

Examples

The pill slides to the current link, and below 768px each link keeps only its glyph.
In a shellA research app's top bar, its name at the start, Nav in the middle and the signed-in person's profile link at the end.

Variants

PlainThe --thumb pill with no edge, for a nav inside a grey track that already sets the pill apart.

States

No currentNo item is highlighted on a page outside the nav.
TabsBelow 640px the host renders NavTabs in Nav's place, a bar at the bottom edge with the label under each glyph.

Usage

Use it when

  • The app has 2 to 5 sections and you move between them on every visit.
  • The current section must be visible at a glance from any page.

Use something else when

  • The links switch views of one thing in place without changing the URL. Use Tabs or SegmentedControl instead.
  • The link goes one level up to a list. Use BackLink instead.
  • The row is a filter whose choices can be any number. Use ChipRow instead.
  • The path is deeper than one level and needs every ancestor shown. Use BackLink for one level up and a plain row of links for deeper paths, the Breadcrumb row of coverage-gaps, instead.

Rules

General

Content

Avoid

Limits

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/nav.json
import { Nav, NavTabs, type NavItem, type NavProps, type NavTabsProps } from "@/components/cobalt/ui/nav"