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.
Six sections, last edited by Mara Chen two hours ago.
Three open threads, one waiting on you.
Twelve versions this week; restore any of them.
Deleted blocks stay here for 30 days.
When to use
- Page-level tabs under a header.
- Switching views where the direction of travel helps.
When not to use
- Segmented choices inside a form; use the segmented control.
- Many tabs on a phone, where an overflow menu is clearer.
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.
API reference
StretchTabs
6 props
Keyboard
- →
- Moves to the next item or value.
- ←
- Moves to the previous item or value.
- Home
- Jumps to the first item or the minimum.
- End
- Jumps to the last item or the maximum.
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.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/stretch-tabs.mdThe index of every part is at /llms.txt.