Components

Number Ticker

An animated number counter for React and Tailwind CSS that springs up or down to its value when it scrolls into view. Formatting uses Intl.NumberFormat (locales, currency, percent, decimals), digits are tabular so nothing jitters, and the final value is rendered on the server for SEO.

  • Server-rendered final value
  • Intl.NumberFormat
  • Spring physics
  • Counts up & down
  • No re-renders
  • prefers-reduced-motion
GitHub stars
12,480+
Uptime
99.98%
Monthly revenue
$48,200

Installation

$ npx shadcn@latest add https://duskui.com/r/number-ticker.json

Usage

stats.tsx
import { NumberTicker } from "@/components/dusk/text/number-ticker"

export function Stats() {
  return (
    <p className="text-4xl font-bold">
      <NumberTicker value={48200} currency="USD" decimals={0} />
    </p>
  )
}

Examples

Locales & formats

Pass a locale, a currency, fixed decimals or any Intl.NumberFormat options through format. Set from above value to count down.

de-DE · EUR1.234.567,89 €
en-IN · grouping1,25,00,000
ja-JP · JPY¥98,000
percent87.3%
countdown0s left

Live values

When value changes, the number springs from where it is to the new value, up or down. A little bounce makes updates feel physical.

Cart total · 3 items

$74.97

API Reference

Also accepts any HTML attribute for the rendered element.

PropTypeDefaultDescription
valuenumber—The number to count to. Changing it springs from the current value.
fromnumber0Where the count starts the first time it comes into view.
localestring"en-US"Locale for Intl.NumberFormat. Fixed by default so server and browser output match.
currencystring—ISO 4217 code such as "USD". Formats as currency.
decimalsnumber—Fixed decimal places. Defaults to the decimals in value (or the currency's default).
formatIntl.NumberFormatOptions—Any other formatter options (notation, style, signDisplay…). They win over the props above.
prefixstring—Text before the number.
suffixstring—Text after the number, e.g. "+" or "%".
durationnumber1.6Spring duration in seconds.
bouncenumber0Spring bounciness (0–1). 0 never overshoots the target.
delaynumber0Seconds to wait after entering the view.
oncebooleantrueCount only the first time. When false it recounts on every entry.
animatebooleantrueSet to false to always show the final value.
as"span" | "p" | "div" | "strong" | "data" | "h1" … "h6""span"Element to render. "data" also sets its machine-readable value attribute.

Accessibility

  • The final, formatted value is rendered on the server, so crawlers and no-JS visitors see the real number, not 0.
  • Screen readers read the final value from a visually hidden copy; the animating digits are aria-hidden, so nothing is announced mid-count.
  • tabular-nums and a reserved width (the wider of the start and end values) prevent layout shift while counting.
  • The count runs outside React (Motion value written to the DOM), so it never re-renders your page.
  • With prefers-reduced-motion the final value is shown immediately.