Dice roll
Dice that tumble and land. Roll and each die spins through several turns, hops and settles face up on its number, one just after another; the total is announced when they have all landed.
Total 9
When to use
- Games, random picks and icebreakers.
- Playful moments: who goes first, a random reward.
When not to use
- Anything where the result must be auditable; use a server-side draw and show its result.
- More than three dice; use numbers.
Installation
pnpm dlx shadcn@latest add @caliper/dice-roll
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
DiceRoll
3 props
Also accepts the native props of its root element and a ref.
Keyboard
- No custom key handling; Tab and the native activation keys do the work.
Accessibility
It exposes img semantics, with aria-label and aria-live 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/dice-roll.mdThe index of every part is at /llms.txt.