Skip to content
caliper ui docs

Pro

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
pnpm dlx shadcn@latest add @caliper/card-dealer

Practice table

Deal, play a card, sort the hand.

Discard pile, empty
15 in deck · 0 played

Installs components/ui/card-dealer.tsxDepends on @radix-ui/react-slot, lucide-reactMotion honours reduced motion

When to use

Use it for

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

Skip it when

  • 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.

Decisions

Why it is built this way, so you know what to keep when you change your copy.

Behaviour

Rest, then fly
Every card's resting place is a transform; a move animates from where it was to where it rests, through a lifted midpoint, so a card always lands exactly in place.
Turn at the top
A card that changes face passes edge-on at the top of its arc, where the swap is hidden by the turn.

Usage

Buttons for the moves
The top of the deck deals, each hand card plays itself, and Deal, Sort hand and Collect are buttons; every move is announced.

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.

Usage

Import it from your copy of the source. The example behind the preview comes with the source. It is built from CardDealer and cardName.

example.tsx
import { CardDealer, cardName } from "@/components/ui/card-dealer"

The worked example comes with Pro

The 27-line example behind the preview opens here, ready to copy.

  • 602 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
Checking your licence…

API reference

CardDealer

component

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

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

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.

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

Motion

It checks prefers-reduced-motion itself and settles immediately instead of travelling. Every state is still reachable.

All Compare & browse examples