uiniverse

text

Counter

Animated number counter that smoothly increments from one value to another with eased timing. Ideal for stats sections, dashboards, and metric displays.

v1.0.0react >=18next >=14tailwind >=4
textcounternumberstatsmetricsanimated

Preview

Loading preview...

Props

PropTypeDefaultDescription
fromnumber0Starting number
to*numberTarget number to count to
durationnumber2000Animation duration in milliseconds
decimalsnumber0Number of decimal places to display
separatorstring,Thousands separator character
prefixstringText prepended to the number (e.g., '$')
suffixstringText appended to the number (e.g., '%')
triggerOnViewbooleantrueStart counting when element enters viewport
classNamestringAdditional Tailwind classes
idstringHTML id attribute

Layout

Display: inline
Responsive: No

Renders as an inline span with tabular-nums for stable digit widths. Place inside headings, stat cards, or grid cells.

Examples

Revenue counter

<Counter to={1250000} prefix="$" className="text-5xl font-bold" />

Percentage with decimals

<Counter to={99.9} decimals={1} suffix="%" className="text-4xl font-semibold" />

Stats row

<div className="flex gap-16">
  <div>
    <Counter to={50000} suffix="+" className="text-5xl font-bold" />
    <p className="text-neutral-400">Users</p>
  </div>
  <div>
    <Counter to={12} suffix="M" prefix="$" className="text-5xl font-bold" />
    <p className="text-neutral-400">Revenue</p>
  </div>
  <div>
    <Counter to={99.9} decimals={1} suffix="%" className="text-5xl font-bold" />
    <p className="text-neutral-400">Uptime</p>
  </div>
</div>

Custom duration and range

<Counter from={100} to={500} duration={3000} className="text-6xl font-black" />

AI Usage Hint

Use Counter for stats sections — revenue numbers, user counts, metrics. Set 'from' and 'to' for the range. Add 'prefix' ($) or 'suffix' (%) for formatted display. Use decimals for precise values. Place multiple Counters in a flex/grid row for a stats bar. Triggers on viewport entry by default.

Works Well With

FadeUpGradientText