Skip to content
caliper ui pro docs

Card dealer

A card table with a face-down deck, a fanned hand and a discard pile. Dealt cards arc off the deck and turn over in flight, played cards arc to the pile, sorting makes the hand's cards hop over each other into order, and collecting sweeps everything back.

Pro
Discard pile, empty
15 in deck · 0 played

When to use

  • Card games, quizzes and flash-card study apps.
  • Playful onboarding or rewards where cards stand for choices.

When not to use

  • Ordinary content cards; this is a table of playing cards.
  • Hands of more than about ten cards on a phone; the fan gets too tight to tap.

Installation

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

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

CardDealer

3 props

Also accepts the native props of its root element and a ref.

PropTypeDefaultDescription
cards *PlayingCard[]—The deck, top card last.
handSizenumber7The most cards the hand holds.
initialHandnumber0Cards already in the hand when the table first shows.

cardName

3 props
PropTypeDefault
id *string—
rank *"A" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "Q" | "J" | "K"—
suit *CardSuit—

Keyboard

  • No custom key handling; Tab and the native activation keys do the work.

Accessibility

It is built on native elements and keeps aria-hidden, aria-label and aria-live in step with state. Changes that matter are announced through a live region.

Motion

  • State changes animate with the library's shared durations and curves, so its timing matches every other part.
  • Under reduced motion each change lands on its end state without movement; nothing is hidden or skipped.

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-dealer.md

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

More in Compare & browse