Morph tabs
Tab bar where the active indicator springs between tabs. Indicator pill morphs position and width with spring overshoot, coloured by cursor position via pastelColour.
- Spring Physics
- requestAnimationFrame
- pastelColour
Your project at a glance. Key metrics, recent activity, and quick actions.
Usage
Drop it in
import { MorphTabs } from "@/app/lib/components/morph-tabs";<MorphTabs
tabs={["Overview", "Analytics", "Settings"]}
activeIndex={active}
onChange={setActive}
/>API
Props
| Prop | Type | Default |
|---|---|---|
tabs* | string[] | — |
activeIndex* | number | — |
onChange* | (index: number) => void | — |
className | string | "" |
ariaLabelAccessible name for the tab list. | string | — |
idPrefixWhen set, tabs get ids `${idPrefix}-tab-${i}` and point at panels with ids `${idPrefix}-panel-${i}`, so the page can wire up role="tabpanel". | string | — |
Read from the component's source at build time. * required.
Accessibility
Works with
- Cursor
- Reacts to where the pointer is, not just whether it's over the element.
- Touch
- Follows your finger while it's down, then settles a moment after you lift.
- Keyboard
- Focus lights it up the way the cursor does. Every action has a key.
- Reduced motion
- Nothing moves or springs. Colour still answers, without drifting.