Skip to content
caliper ui pro docs

Coin flip

A coin for settling small things. Press it and it leaps, tumbles end over end and lands with a small bounce while its shadow shrinks and returns beneath it.

Pro

Press the coin

Heads 0 · Tails 0

When to use

  • Decision helpers, games and playful empty states.
  • Choosing who goes first.

When not to use

  • Anything with stakes; it is visual randomness, not a fair-play service.
  • Results that must be repeatable.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/coin-flip

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.

API reference

CoinFlip

4 props

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

PropTypeDefaultDescription
faces[ReactNode, ReactNode]["H", "T"]What each face shows.
names[string, string]["Heads", "Tails"]The side names, read aloud with the result.
onFlip((side: CoinSide) => void)—
durationnumber1500Flight time in milliseconds.

Keyboard

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

Accessibility

It exposes status semantics, with aria-label and aria-disabled kept 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/coin-flip.md

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

More in Surfaces