Skip to content
VenusUI
Get started

Number Ticker

Counts up to a number when it scrolls into view, with locale-aware formatting.

Preview

Installation

npx shadcn@latest add @venusui/number-ticker

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/number-ticker.tsx

Usage

The code behind the preview above.

number-ticker-demo.tsx

import { NumberTicker } from "@/components/ui/number-ticker"

export default function NumberTickerDemo() {
  return (
    <div className="grid w-full max-w-md grid-cols-2 gap-6 text-center">
      <div>
        <NumberTicker value={12480} className="text-4xl font-semibold tracking-tight" />
        <p className="mt-1 text-sm text-muted-foreground">Installs</p>
      </div>
      <div>
        <NumberTicker value={99.95} decimals={2} className="text-4xl font-semibold tracking-tight" />
        <span className="text-4xl font-semibold">%</span>
        <p className="mt-1 text-sm text-muted-foreground">Uptime</p>
      </div>
    </div>
  )
}

API reference

PropTypeDefaultDescription
valuenumber—Number to count to. Required.
fromnumber0Number to start from. Can be larger than value to count down.
durationnumber2000Animation length, in milliseconds.
decimalsnumber0Digits after the decimal point.
localestring—Locale for formatting, e.g. en-IN for 1,00,000. Defaults to the visitor’s locale.
formatOptionsIntl.NumberFormatOptions—Extra formatting, e.g. { style: "currency", currency: "INR" }.

All <span> props except children.

Requirements

  • React 19 and Tailwind CSS v4, with a cn helper at @/lib/utils. No other dependencies.

Customization

  • Pass formatOptions={{ style: "percent" }} with a value like 0.42 for percentages, or notation: "compact" for 12K-style numbers.
  • Pass locale to format the same way for every visitor; otherwise the browser’s locale is used.

Accessibility

  • Screen readers get the final value from a visually hidden copy, not the changing digits.
  • With reduced motion, the final value appears immediately.

Troubleshooting

The number stays at the start value.
It starts when 40% of it is visible. In a scroll container or a hidden tab, make sure it actually becomes visible.
Different separators on server and client.
Pass a fixed locale so the server-rendered start value and the animated value use the same format.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

Blur Text

Text animations

Text whose words rise out of a blur one after another.

Loading preview

Gradient Text

Text animations

Text filled with a slowly moving gradient: a subtle sheen by default, or your own colors.

Loading preview

Rotating Words

Text animations

Cycles through words with a vertical slide, pausing on hover.