Odometer Stats

Numbers that roll into place digit by digit, like a mechanical counter.

Category
Creative
Access
Free with an account
Source
187 lines · one file
States
4 drawn

The decision inside it

It never jitters

Every wheel is a fixed-width tabular digit, so 1,999 rolling to 2,000 never shuffles its neighbours, and a new digit grows on the left. It rolls the way the number moved. A screen reader hears the final number once, not every wheel.

When to use it

Use Odometer Stats for a row of headline numbers that roll into place and keep rolling as they change. For a single number use Odometer.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Odometer Stats for this.
Install it: npx shadcn@latest add @liro/odometer-stats
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/odometer-stats.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/stats.tsx
import { OdometerStats } from "@/components/ui/odometer-stats";

export function Stats() {
  return (
    <OdometerStats
      locale="en-US"
      stats={[
        { label: "Processed today", value: 1284000, format: { style: "currency", currency: "USD", maximumFractionDigits: 0 } },
        { label: "Teams online", value: 2431 },
        { label: "Uptime, 90 days", value: 0.9998, format: { style: "percent", minimumFractionDigits: 2 } },
      ]}
    />
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
valuenumber Yes–
formatIntl.NumberFormatOptions No`Intl.NumberFormat` options. Default plain grouping.
localestring NoLocale for the format. Default the reader's.
fromZeroboolean NoRoll from zero the first time it scrolls into view. Default true.

Dependencies

npm packages

clsxframer-motiontailwind-merge

Liro foundations, installed alongside it

liro-theme

States

All of them are drawn by the component. None is left for you to design.

  • Rolling in
  • Rolling up
  • Rolling down
  • Reduced motion

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances