Number Ticker for React
A number ticker for React where every digit is a little wheel that rolls to its new value, formatted with Intl.NumberFormat. Use it as an animated counter for KPI tiles and dashboard totals that change when a date range or filter changes, so each digit rolls to its new value like an odometer.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/number-ticker.jsonMonthly revenue
$12,480
402,118 users
Live stats
Digits roll up when a value rises and down when it falls; new places slide in. Places that went through a full cycle spin an extra turn, like an odometer.
Revenue
$48,250
Active users
1.3M
Conversion
4.8%
Seats taken
98
import { NumberTicker } from "@/components/sheenui/number-ticker/number-ticker";
// Package build (after the first npm release, or a packed tarball): import { NumberTicker } from "@sheenui/theme";
export function Example() {
const revenue = 128400;
const users = 18250;
const rate = 0.043;
const count = 42;
return (
<>
<NumberTicker value={revenue} locales="en-US" format={{ style: "currency", currency: "USD", maximumFractionDigits: 0 }} />
<NumberTicker value={users} locales="en-US" format={{ notation: "compact", maximumFractionDigits: 1 }} />
<NumberTicker value={rate} locales="en-US" format={{ style: "percent", minimumFractionDigits: 1, maximumFractionDigits: 1 }} />
<NumberTicker value={count} from={count} locales="en-US" />
</>
);
}Files to copy
5 folders · 5 files · 3 packages
- From
theme/src/ components/number-ticker/hooks/{use-media-query.ts, use-preferences.ts}motion/tokens.tslib/{canvas-effects.ts, cn.ts}styles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/number-ticker.jsonRegistry item: number-ticker. The styles need the Tailwind v4 glass UI setup.- The examples also use
components/glass-card/motion/light-follower.tslib/heading.ts
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/glass-card.json- Packages
pnpm add clsx motion tailwind-merge
Any locale, any numbering system
The same value through Intl.NumberFormat: separators, symbols and even the digits themselves follow the locale. In right-to-left locales the digits still read left to right, and the currency sits where the browser puts it.
- German, euro
- 1.234.567,89 €
- Indian grouping, rupee
- ₹12,34,567.89
- Japanese, yen
- ¥1,234,567
- Arabic-Indic digits
- ١٬٢٣٤٬٥٦٧
- Devanagari digits
- १२,३४,५६७
- Compact, French
- 1,2 million
- Egyptian pound, right to left
- ١٬٢٣٤٬٥٦٧٫٨٩ ج.م.
- Shekel, right to left
- 1,234.50 ₪
import { GlassCard } from "@/components/sheenui/glass-card/glass-card";
import { NumberTicker } from "@/components/sheenui/number-ticker/number-ticker";
// Package build (after the first npm release, or a packed tarball): import { GlassCard, NumberTicker } from "@sheenui/theme";
// This example also uses glass-card: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/glass-card.json
const rows = [
["German, euro", "de-DE", { style: "currency", currency: "EUR" }, 1234567.89],
["Indian grouping, rupee", "en-IN", { style: "currency", currency: "INR" }, 1234567.89],
["Japanese, yen", "ja-JP", { style: "currency", currency: "JPY", currencyDisplay: "narrowSymbol" }, 1234567],
["Arabic-Indic digits", "ar-EG", {}, 1234567],
["Devanagari digits", "hi-IN-u-nu-deva", {}, 1234567],
["Compact, French", "fr-FR", { notation: "compact", compactDisplay: "long" }, 1234567],
["Egyptian pound, right to left", "ar-EG", { style: "currency", currency: "EGP" }, 1234567.89],
["Shekel, right to left", "he-IL", { style: "currency", currency: "ILS" }, 1234.5],
] as const;
export function Example() {
return (
<dl className="grid w-full max-w-2xl gap-3 sm:grid-cols-2">
{rows.map(([label, locale, format, value]) => (
<GlassCard key={label} level={1} sheen={false} className="flex flex-col gap-1 px-4 py-3">
<dt className="text-xs text-sheen-fg-muted">{label}</dt>
<dd className="text-xl font-semibold">
<NumberTicker value={value} locales={locale} format={format} />
</dd>
</GlassCard>
))}
</dl>
);
}Counts up when it comes into view
It starts from `from` (0 by default) and rolls the first time it is on screen. Pass from={value} to skip that.
2.4M+
developers ship with glass every month
import { NumberTicker } from "@/components/sheenui/number-ticker/number-ticker";
// Package build (after the first npm release, or a packed tarball): import { NumberTicker } from "@sheenui/theme";
export function Example() {
return (
<p className="text-6xl font-semibold tracking-tight sm:text-7xl">
<NumberTicker value={2400000} locales="en-US" format={{ notation: "compact" }} suffix="+" delay={0.2} />
</p>
);
}Props
Keyboard
Accessibility
- The digit wheels are aria-hidden; the final value is in a visually hidden live region (live="polite" by default), so it is read once, correctly formatted, not digit by digit.
- Under reduced motion the value appears at once.
When to use the number ticker effect
- Use it for the headline figure of a KPI tile or a totals row that is recalculated when someone picks another date range or filter, so the change reads as motion instead of a jump.
- Use it for a price or revenue figure with currency formatting, such as 48,250 dollars with no decimals, or a stat row on a landing page that counts up when it scrolls into view.
- Use prefix and suffix for units like a plus sign or a percent, and locales with format for compact numbers or other numbering systems; right-to-left locales are laid out correctly.
- Skip it when the number is static or updates many times a second; plain text is better, and live="off" or a non-animated figure suits values that change constantly and would spam screen readers.
- Pair it with GlassCard for a stat tile, Sparkline for the trend beside it, and SegmentedControl so switching the period makes the digits roll to the new values.
Frequently asked questions
Related pages
Guides that cover it
19 effects pages in all: browse them on All effects.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .