Spin wheel
A prize wheel you flick or spin. It keeps the speed you gave it and slows with friction while a flexible pointer ticks against each peg. The prize is drawn by weight before the wheel slows, so the odds are honest however it is spun.
When to use
- Referral rewards, promotions and launch-day giveaways.
- Team rituals: who presents, who picks lunch.
When not to use
- Anything where the outcome matters to someone's money or access without clear, published odds.
- Choices people should make themselves; use a list.
Installation
pnpm dlx shadcn@latest add @caliper/spin-wheel
Adds its 4 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
SpinWheel
3 props
Also accepts the native props of its root element and a ref.
pickWeighted
0 props
No props of its own; it accepts the native props of its root element.
Keyboard
- No custom key handling; Tab and the native activation keys do the work.
Accessibility
It exposes img semantics, with aria-label, aria-hidden 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/spin-wheel.mdThe index of every part is at /llms.txt.