Pro
Stretch tabs
Tabs whose underline moves like an inchworm: the leading edge reaches the new tab first and the trailing edge catches up, so the line stretches across the gap and contracts onto its label.
pnpm dlx shadcn@latest add @caliper/stretch-tabsWhen to use
Use it for
- Page-level tabs under a header.
- Switching views where the direction of travel helps.
Skip it when
- Segmented choices inside a form; use the segmented control.
- Many tabs on a phone, where an overflow menu is clearer.
Decisions
Why it is built this way, so you know what to keep when you change your copy.
Behaviour
- Real tabs
- Roving focus, arrow keys, Home and End, and each panel labelled by its tab.
Styling
- Two edges, two timings
- Left and right each have their own transition, and the trailing one starts 90ms later. No script runs during the move.
Installation
pnpm dlx shadcn@latest add @caliper/stretch-tabs
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
Import it from your copy of the source. The example behind the preview comes with the source.
import { StretchTabs } from "@/components/ui/stretch-tabs"
The worked example comes with Pro
The 37-line example behind the preview opens here, ready to copy.
- 576 Pro parts, blocks and page templates, all with source
- $199 once, with a year of updates. What you have stays yours
- A full refund within 14 days if it is not for you
API reference
StretchTabs
component
Accessibility
It exposes tablist, tab and tabpanel semantics, with aria-label, aria-selected, aria-controls, aria-hidden and aria-labelledby kept in step with state.
Motion
Transitions use the shared duration and easing tokens. Under prefers-reduced-motion those tokens collapse to instant and travel distances go to zero, so state changes still happen without movement.