Pill Nav
ProNewA 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
| Prop | Type | Default |
|---|---|---|
| items* | PillNavItem[] | — |
| active* | stringThe `href` of the current page. | — |
| onNavigate | (href: string, event: React.MouseEvent<HTMLAnchorElement>) => voidCalled with the item's `href` when a link is activated. Call `event.preventDefault()` to route yourself. | — |
| label | stringAccessible name for the navigation landmark. | "Main" |
| className | string | — |
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.