Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Pill Nav

ProNew

A floating nav with one pill that glides to the current page and another that follows your pointer.

Installation

pnpm dlx shadcn@latest add @viewport/pill-nav

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
items*PillNavItem[]—
active*string

The `href` of the current page.

—
onNavigate(href: string, event: React.MouseEvent<HTMLAnchorElement>) => void

Called with the item's `href` when a link is activated. Call `event.preventDefault()` to route yourself.

—
labelstring

Accessible name for the navigation landmark.

"Main"
classNamestring—

Accessibility

  • A nav landmark of real links; the current one has aria-current.
  • The hover pill follows keyboard focus too; Left, Right, Home and End move between links.
  • Scrolls sideways on narrow screens instead of wrapping, with a fade on the edge that has more.