Skip to content
caliper ui pro docs

Card switcher

An app switcher for open pages. Cards fan out in depth by recency: the page you are on is in front and each step back is one page older. Flick a card up to close it, press the front card to open it full size.

Pro
Left and right arrows switch, Enter opens, Delete closes, Escape returns from a page.
5 open · 3 of 5

When to use

  • Mobile-style multitasking: open documents, tabs or conversations.
  • Reviewing a handful of recent items and dropping the ones you are done with.

When not to use

  • Long lists; use a list with search.
  • Anything that needs all items visible at once.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/card-switcher

Adds its 7 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

CardSwitcher

14 props
PropTypeDefaultDescription
label *string—Accessible name of the switcher, for example "Open pages".
pages *readonly SwitcherPage[]—
currentstring—The id of the front card. Controlled when set; defaults to the last page.
defaultCurrentstring—
onCurrentChange((id: string) => void)—
onClose((id: string) => void)—Called with a page's id after its card has flicked away. Remove the page from `pages`.
onOpen((id: string) => void)—
onBack(() => void)—Called when the full-size page is dismissed.
onReopen(() => void)—When set, the empty switcher offers a "Reopen all" button that calls it.
statusDepthStatus"ready"
messagesDepthMessages—
onRetry(() => void)—
disabledboolean—
classNamestring—

Keyboard

Escape
Closes or cancels, then returns focus to where it came from.
←
Moves to the previous item or value.
→
Moves to the next item or value.
Delete
Removes the next character or the selected item.

Accessibility

It exposes group and region semantics, with aria-label, aria-describedby, aria-hidden and aria-live kept in step with state. Changes that matter are announced through a live region.

Notes for AI

Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.

/docs/components/card-switcher.md

The index of every part is at /llms.txt.

More in Surfaces