Skip to content

Rolling Counter

Numbers roll into place on individual digit reels.

LIVE PREVIEWInteract with the component
Just React. No extra dependencies.

Copy the component and its CSS module into your project.

CSS Modules

Usage

Matches your current playground settings.

jsx
import RollingCounter from "./RollingCounter";
export default function Example() {
return (
<RollingCounter
value={12840}
decimals={0}
separator={","}
decimalSeparator={"."}
prefix={""}
suffix={""}
duration={900}
/>
);
}

Using Rolling Counter

Pass the numeric value directly and set decimals for its precision. prefix and suffix can provide a currency symbol or unit.

Use separator and decimalSeparator for the desired number formatting. Keep the formatted value narrow enough for the available layout.

Props

NameTypeRequiredDefaultDescription
valuenumberNo0The number to display. Non-finite numbers display zero.
decimalsnumberNo0Decimal places, clamped from 0 to 6.
separatorstringNo","Thousands separator. Use an empty string to disable grouping.
decimalSeparatorstringNo"."Character between the integer and fraction.
prefixstringNo""Text before the number.
suffixstringNo""Text after the number.
durationnumberNo900Digit transition duration in milliseconds.
classNamestringNo""Additional CSS classes, merged with the component styles.
styleCSSPropertiesNoundefinedInline styles for caller-defined sizing and visual overrides.

Related components

Reflection Text

Text Effects

Crisp typography meets a soft, fading reflection beneath the baseline.

Morphing Words

Text Effects

Words dissolve through a soft blur while the headline keeps its width.

Dot Matrix Text

Text Effects

Amber pinpoints form a crisp matrix display with a soft travelling pulse.

Scan Text

Text Effects

A warm scanning light brings a dim headline into focus.