Skip to content
caliper ui pro docs

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
0 dropped

When to use

  • Explaining probability and averages.
  • A playful result screen where chance is the point.

When not to use

  • Anything that must be fair to a user, like a prize draw; use a server-side draw.
  • Thousands of balls.

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.

API reference

PlinkoBoard

3 props

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

0 props

No props of its own; it accepts the native props of its root element.

lane

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 and aria-hidden kept in step with state.

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/plinko-board.md

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

More in Changing values