PillNav
Pill whose highlight stretches toward the item you pick. Navigation.
Open playgroundAbout
PillNav is a React component in the Navigation category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { PillNav } from "@ashutoshswamy/smoui" and set items, defaultValue, onChange.
Install
npm i @ashutoshswamy/smouiUsage
import { PillNav } from "@ashutoshswamy/smoui";
<PillNav
items={[{ id: "work", label: "Work" }, { id: "about", label: "About" }]}
onChange={(id) => console.log(id)}
/>Props 3
- items
Nav entries.
{ id: string; label: string }[]- defaultValue
Initially active id. Defaults to the first.
string- onChange
Called when the active item changes.
(id: string) => void
More navigation components
- BreadcrumbsA trail that folds its middle into an ellipsis. Press it and the hidden crumbs spring out in order.
- DockIcons swell around the cursor and settle back on a spring.
- FlyoutNavOne panel that follows you. Move between items and it glides sideways and resizes to the new content while the content cross-fades.
- GooMenuA plus that throws its items out as liquid bubbles and fuses them back on close.
- MorphTooltipOne tooltip for the whole toolbar. It stretches to the next tool and resizes to its label.
- PaginationOne accent pill slides to the page you pick. Long lists fold into ellipses that follow the current page.