Card Dealer

A card table with a face-down deck, a fanned hand and a discard pile. Cards arc across the table between them and flip in flight, hop over each other when the hand is sorted, and lift on hover. Data-driven by each card's zone, with custom faces and backs, keyboard-playable hand cards and reduced-motion support.

Preview

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/card-dealer

API Reference

cards
T[]

Every card on the table. Order within each zone is the stacking and fan order.

—
renderFace
(card: T) => ReactNode

The card's face.

—
renderBack?
((card: T) => ReactNode)

The card's back, shown while it sits in the deck.

—
onCardSelect?
((id: string) => void)

Makes hand cards buttons. Called with the card's id.

—
cardWidth?
number

Card size in px. Default 84 by 120.

84
cardHeight?
number
120
spread?
number

Most horizontal space between neighbouring hand cards, in px. Default 46.

46
angle?
number

Rotation between neighbouring hand cards, in degrees. Default 5.

5
aria-label?
string

Accessible name for the table. Default "Card table".

Card table
className?
string
—

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.

Updated