Miss. Train. Move.

Scoreboard roll

Counters, prices, stats. Digits roll in one after another, like a stadium board.

Home · Away

21

Crowd 61,284

Sport
Football
Move
Digits roll in one after another, like a stadium board.
For
Counters, prices, stats

560ms settle per digit · 40ms stagger from the right · reduced: swap

01 Install

Terminal
npx shadcn@latest add https://moveui-red.vercel.app/r/scoreboard-roll.json

It brings the tokens with it. The first time, import the tokens once in your root layout:

app/layout.tsx
import "@/components/moveui/tokens.css";

Not using shadcn? Copy the files below into components/moveui/, and tokens.css next to them.

02 Use it

Example
import { ScoreboardRoll } from "@/components/moveui/scoreboard-roll/scoreboard-roll";

<ScoreboardRoll value={attendance} />

03 Or ask your agent

Paste this into Claude Code, Cursor or any coding agent. It installs the piece and wires it in.

Prompt
Add the Move UI "Scoreboard roll" piece to this project. It's for: Counters, prices, stats.

1. Install it: npx shadcn@latest add https://moveui-red.vercel.app/r/scoreboard-roll.json
2. If the project doesn't import the Move UI tokens yet, add this once to the root layout: import "@/components/moveui/tokens.css";
3. Use it like this, adapted to where it belongs in my code:

import { ScoreboardRoll } from "@/components/moveui/scoreboard-roll/scoreboard-roll";

<ScoreboardRoll value={attendance} />

Keep its reduced-motion behaviour and keyboard support. Don't hardcode durations, easing or colours: they come from the --ml-* tokens.
Docs: https://moveui-red.vercel.app/pieces/scoreboard-roll

Want your agent to know the whole library and its motion rules? Add the Move UI skill to your project:

Terminal
npx shadcn@latest add https://moveui-red.vercel.app/r/skill.json

04 Code

components/moveui/scoreboard-roll/scoreboard-roll.tsx
import type { HTMLAttributes } from "react";
import "./scoreboard-roll.css";

/**
 * Scoreboard roll: a number that rolls digit by digit, like a stadium board.
 * Each digit is a strip of 0 to 9 that slides to its value; the digits start one after another
 * from the right (--ml-stagger-digit), so a 9 turning into 10 reads like a real board.
 * Columns are keyed from the right, so they keep their place when the number grows.
 * Screen readers get the plain value. No JS: it is just CSS transforms.
 */
type Props = HTMLAttributes<HTMLSpanElement> & {
  value: number;
  format?: (n: number) => string;
};

const DIGITS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];

export function ScoreboardRoll({ value, format = (n) => n.toLocaleString("en-GB"), className, ...props }: Props) {
  const text = format(value);
  const chars = [...text];
  return (
    <span className={["ml-roll", className].filter(Boolean).join(" ")} {...props}>
      <span className="ml-roll__sr">{text}</span>
      <span className="ml-roll__board" aria-hidden="true">
        {chars.map((ch, i) => {
          const fromRight = chars.length - 1 - i;
          const d = Number(ch);
          if (Number.isNaN(d) || ch === " ") {
            return <span key={`s${fromRight}`} className="ml-roll__sep">{ch}</span>;
          }
          return (
            <span key={`d${fromRight}`} className="ml-roll__digit" style={{ ["--d" as string]: d, ["--n" as string]: fromRight }}>
              <span className="ml-roll__strip">
                {DIGITS.map((n) => <span key={n}>{n}</span>)}
              </span>
            </span>
          );
        })}
      </span>
    </span>
  );
}
components/moveui/scoreboard-roll/scoreboard-roll.css
/*
  Scoreboard roll. Each digit strip slides to its value on --ml-dur-travel with --ml-ease-settle,
  starting --ml-stagger-digit after the digit to its right. Reduced motion: tokens make it a quick swap.
*/
.ml-roll {
  --ml-stagger-digit: 40ms;
  --_h: 1.2em; /* each digit gets a little headroom, so tall bold glyphs are never cropped */
  display: inline-block;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ml-roll__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.ml-roll__board { display: inline-flex; }
.ml-roll__digit {
  display: inline-block;
  height: var(--_h);
  margin-block: calc((1em - var(--_h)) / 2); /* the headroom takes no extra space in the line */
  /* Room at the sides too: with tight letter-spacing a glyph overhangs its box, and the edge mask
     below would cut the overhang off. The negative margin keeps the layout exactly as before. */
  padding-inline: 0.15em;
  margin-inline: -0.15em;
  /* Clip only top and bottom: sideways the glyph may overhang (tight letter-spacing) */
  overflow-x: visible;
  overflow-y: clip;
  /* the mask softens the top and bottom edge like a board window, only inside the headroom */
  mask-image: linear-gradient(transparent, #000 8%, #000 92%, transparent);
}
.ml-roll__strip {
  display: flex;
  flex-direction: column;
  transform: translateY(calc(var(--d) * -1 * var(--_h)));
  transition: transform var(--ml-dur-travel) var(--ml-ease-settle) calc(var(--n) * var(--ml-stagger-digit));
}
.ml-roll__strip > span { height: var(--_h); line-height: var(--_h); display: block; text-align: center; }
@media (prefers-reduced-motion: reduce) {
  .ml-roll { --ml-stagger-digit: 0ms; }
}