Pro
Tab strip
Tabs a person opens and closes, like a browser's. Tabs shrink evenly as more open, a closed tab folds its width away before it leaves, the open tab scrolls into view, and arrows, Delete and the New tab button all work from the keyboard.
pnpm dlx shadcn@latest add @caliper/tab-stripWhen to use
Use it for
- Editors, terminals, consoles and record viewers with several things open at once.
- Workspaces where people choose what stays open.
Skip it when
- A fixed set of views; use tabs.
- Navigation between pages; use the site's navigation.
Decisions
Why it is built this way, so you know what to keep when you change your copy.
Behaviour
- Neighbour opens
- Closing the open tab opens the one after it, or before it at the end, and focus follows when the closed tab had it.
- Close stays out of the tab order
- Close buttons are reachable by pointer; from the keyboard, Delete closes the focused tab, keeping Tab for leaving the strip.
Installation
pnpm dlx shadcn@latest add @caliper/tab-strip
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 { TabStrip } from "@/components/ui/tab-strip"
The worked example comes with Pro
The 52-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
TabStrip
component
Also accepts the native props of its root element and a ref.
Accessibility
It exposes tablist and tab semantics, with aria-label, aria-selected and aria-hidden kept in step with state.
Motion
It checks prefers-reduced-motion itself and settles immediately instead of travelling. Every state is still reachable.
Related
- TabsSwitch between related views of the same content without leaving the page.
- Animated tabsTabs with an expanding or morphing indicator, including closable tabs.
- Folder tabsTabs as folders in a drawer. The chosen folder comes to the front and the rest sit behind it with their tabs showing, so you can see how many there are and where you are. Distance back is the number of steps from the open tab.