Skip to content
caliper ui docs

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.

Pro
pnpm dlx shadcn@latest add @caliper/plinko-board

Chance, made visible

Drop balls and watch a bell curve form.

0 dropped
Installs components/ui/plinko-board.tsxDepends on none beyond ReactMotion honours reduced motion

When 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 balls to 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

terminal
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.

example.tsx
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
Checking your licence…

API reference

PlinkoBoard

component

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

PropTypeDefaultDescription
balls *number—How many balls have been dropped in all. Raise it to drop more; lower it to clear the board.
rowsnumber8Rows of pegs, 4 to 12. Read once, when the board mounts.
onLand((bin: number) => void)—Called as each ball lands, with the bin it ended in (0 is the far left).

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.

All Changing values examples