Data Display

Animated Stats

A group of statistics that count from 0 to their target values when they enter the viewport, with items staggering in and sliding up.

Bring this into your project

Run this command in your project folder. The CLI adds the source and dependencies; then follow the usage example below.

npx webberui@latest add animated-stats.en

New project or installation trouble? Start here →

Playground

Tune the props live — the code snippet updates as you go, so you can dial in the look you want before copying it.

24000
1.6
0.15
0
Active edited usageDefault props
<AnimatedStats/>

The complete example includes the preview layout and data. Install the component first, then paste this file into your project.

Installation

npx webberui@latest add https://webberui.com/r/animated-stats.en.json

Or, once registries are configured in components.json, install it as @webberui/animated-stats.

Usage

import { AnimatedStats, StatItem } from "@/components/ui/animated-stats";

<AnimatedStats>
  <StatItem value={120} suffix="+" label="Components" />
  <StatItem value={98} suffix="%" label="Satisfaction" />
  <StatItem value={3.2} suffix="s" decimals={1} label="Average install time" />
</AnimatedStats>

Props

AnimatedStats

PropTypeDefaultDescription
childrenReact.ReactNode—The statistics (put StatItem here)
delaynumber0Delay before the reveal starts (seconds)
staggernumber0.15Stagger interval between items (seconds)
oncebooleantruePlay only the first time the element enters the viewport

StatItem

PropTypeDefaultDescription
valuenumber—Target value; counts from 0 up to it
labelstring—Caption below the number
prefixstring""Prefix before the number (for example $)
suffixstring""Suffix after the number (for example +, %)
decimalsnumber0Number of decimal places
durationnumber1.6Duration of the counting animation (seconds)

Accessibility

  • When the user has "reduce motion" enabled at the system level, the counting and the stagger are skipped and the final numbers are shown right away
  • The number container carries an aria-label (the final formatted value, including prefix and suffix), and the animating span that counts is hidden from assistive technology (aria-hidden), so screen readers announce only the final value