Pro
Plinko board
A pegboard that turns chance into a shape. Each ball falls through the rows, bouncing left or right at every peg, and lands in a bin; as more balls land, the bins build into a bell curve.
pnpm dlx shadcn@latest add @caliper/plinko-boardWhen to use
Use it for
- Explaining probability and averages.
- A playful result screen where chance is the point.
Skip it when
- Anything that must be fair to a user, like a prize draw; use a server-side draw.
- Thousands of balls.
Decisions
Why it is built this way, so you know what to keep when you change your copy.
Behaviour
- The path is chosen first
- Each ball's turns are drawn with the browser's random numbers before it falls, so the animation never decides the result.
- Driven by a count
- Raise
ballsto drop more and lower it to clear, so the board is easy to control from outside.
Usage
- Counts as a sentence
- The board is an image named with how many balls landed and which bin is fullest.
Installation
pnpm dlx shadcn@latest add @caliper/plinko-board
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.
Usage
Import it from your copy of the source. The example behind the preview comes with the source. It is built from PlinkoBoard, binCount and lane.
import { PlinkoBoard, binCount, lane } from "@/components/ui/plinko-board"
The worked example comes with Pro
The 39-line example behind the preview opens here, ready to copy.
- 626 Pro parts, blocks and page templates, all with source
- $149 once, with lifetime updates. No renewal
- A full refund within 14 days if it is not for you
API reference
PlinkoBoard
component
Also accepts the native props of its root element and a ref.
binCount
component
No props of its own; it accepts the native props of its root element.
lane
component
No props of its own; it accepts the native props of its root element.
Accessibility
It exposes img semantics, with aria-label and aria-hidden kept in step with state.
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.
Related
- HistogramThe shape of a distribution. Choosing coarser or finer bins retargets the same bars, and the median and p95 markers slide to their values.
- Dice rollDice 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.
- Spin wheelA 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.