Xzero UI
Pro library

Animated counter

Give changing totals a clear sense of movement.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/animated-counter
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/animated-counter

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { AnimatedCounter } from "@/components/xzero/animated-counter/animated-counter";

export function Raised({ amount }: { amount: number }) {
  return <AnimatedCounter label="Raised" value={amount} prefix="$" animateOnView />;
}

API reference

AnimatedCounter

An odometer style number whose digit columns roll to each new value.

PropTypeDefaultDescription
value (required)number–The number to show.
labelstring–Small label above the number.
prefixstring""Text before the number, such as "$".
suffixstring""Text after the number, such as "%".
decimalsnumber0Fixed fraction digits.
animateOnViewbooleanfalseRolls every digit up from zero the first time it scrolls into view.
localestring"en-US"Formatting locale. Fixed by default so server and client match.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in charts

Guidance for AI tools

Animated counter: Give changing totals a clear sense of movement. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components