All components
Pill Tabs
NavigationA pill tab bar where the raised pill slides to your selection.
Installation
Add it with the shadcn CLI:
$
pnpm dlx shadcn@latest add https://nawalkattel.com.np/r/pill-tabs.jsonOr install manually
1. Install dependencies
pnpm add motion clsx tailwind-merge2. Copy the component source into
components/library/pill-tabs.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| tabs | string[] | - | Tab labels, in order. |
| active | number | 0 | Initially active index. |
| onChange | (index: number) => void | - | Called with the new index. |
Accessibility
- role=tablist / role=tab with aria-selected on the active tab.
- The active tab changes colour as well as gaining the pill.
- layoutId animates the pill without re-rendering the labels.
Dependencies
motionclsxtailwind-merge