Skip to content

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
import { MorphTabs } from "@/app/lib/components/morph-tabs";
example 1
<MorphTabs
  tabs={["Overview", "Analytics", "Settings"]}
  activeIndex={active}
  onChange={setActive}
/>

API

Props

PropTypeDefault
tabs*string[]—
activeIndex*number—
onChange*(index: number) => void—
classNamestring""
ariaLabel

Accessible name for the tab list.

string—
idPrefix

When 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.