Component packs › Baize › Ball Counter

Ball Counter

Each added ball rolls down the return rail and knocks into the line; each removed one is lifted out.

Ball Counter is a stepper from Baize, a component pack with 6 billiards components: Controls played on a pool table: balls that roll, knock, bank off cushions and drop into pockets. Price: $2 for the whole pack.

Built with: 1D knock chain, slope and stop, thin tabular count.

Code: React and Next.js (TypeScript), Vue 3, plain HTML/CSS/JS, Tailwind CSS v4 and Motion (motion.dev). No npm packages needed. Keyboard accessible, with a reduced-motion version, in dark and light.

Ball Counter props

PropTypeDefaultDescription
valuenumber
minnumber
maxnumberAt most 15 (a full rack).
labelstringWhat is counted, e.g. "Players".
widthnumber360Width in px. Default 360.
darkboolean
onChange(value: number) => void
autoplaynumber | falseShowcase mode: steps up and down every N ms while visible.

Methods on the ref

Use it in React

import BallCounter from './BallCounter';

<BallCounter />

The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.

More in Baize

Good for: Skeuomorphic UI.