Docs
Animated Counter

Animated Counter

Number counter that animates into view with easing when it enters the viewport. Supports prefix, suffix, thousands separators, and decimals.

0+Components
0+GitHub Stars
0+Downloads
0+Contributors

Installation

Usage

import { AnimatedCounter, StatCard } from "@/components/pioneerui/animated-counter"
 
// Single counter inline
export function Headline() {
  return (
    <h2 className="text-4xl font-bold">
      <AnimatedCounter to={10000} suffix="+" duration={2} /> users
    </h2>
  )
}
 
// Pre-built stats row
export function Stats() {
  return (
    <StatCard
      stats={[
        { label: "Components", value: 50, suffix: "+" },
        { label: "Stars", value: 3200 },
        { label: "Downloads", value: 18500, suffix: "+" },
        { label: "Contributors", value: 94 },
      ]}
    />
  )
}

Props — AnimatedCounter

PropTypeDefaultDescription
tonumberTarget number
fromnumber0Starting number
durationnumber2Animation duration in seconds
prefixstring""Shown before the number (e.g. "$")
suffixstring""Shown after the number (e.g. "+")
decimalsnumber0Decimal places

Props — StatCard

PropTypeDescription
statsArray<{ label, value, prefix?, suffix?, decimals? }>Array of stat items