Components
Pill Navbar
A navbar with a pill that slides to the active link.
<PillNavbar links={links} current={pathname} />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/pill-navbar.jsonimport { PillNavbar } from "@/components/pill-navbar"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
A rounded navbar with a pill that slides to the active link and resizes to fit it. Pass onNavigate to hand clicks to your router.
import { PillNavbar } from "@/components/pill-navbar";
import { usePathname } from "next/navigation";
export function Tabs() {
return <PillNavbar links={[{ label: "Overview", href: "/" }, { label: "Billing", href: "/billing" }]} current={usePathname()} />;
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
links | { label, href }[] | The links. | |
current | string | The active link's href. | |
onNavigate | (href, event) => void | Called on click. Call event.preventDefault() to route yourself. | |
label | string | "Main" | Accessible name. |
className | string | Classes for the root element. |
With reduced motion, the pill jumps instead of sliding.