Statistic

Statistic

Data Display
Dashboard

Display numerical statistics with optional formatting, prefixes, suffixes, and animated counting.

Preview

Statistics with animated counting

Active Users

8,249

Tasks Completed

1,847

Avg. Time

24min

Growth

18.5%

Statistic Cards

Statistics wrapped in card containers

Total Revenue

$145,678

Active Sessions

2,847

Conversion Rate

3.24%

Animated Counting

Use CountUp for animated number transitions

Users

0

Revenue

$0

Growth

0.0%

Rating

0.0

Rolling Digits

With animated, each digit rolls to the new value when it changes (see Animated Number)

Active Users

8,249

Growth

18.5%

Sizes

Different size options

Small

1,234

Medium

1,234

Large

1,234

Props

Component API reference

Statistic

PropTypeDefaultDescription
value*number | string—The value to show
titlestring—Stat title/label
prefixReactNode—Content before value (icon or text)
suffixReactNode—Content after value (unit or symbol)
precisionnumber—Fixed number of decimal places for numeric values
formatter(value: number | string) => string—Custom formatting, replaces the default separators
animatedbooleanfalseRoll the digits when the value changes. Numeric values with the default formatter only
trend'up' | 'down' | 'neutral'—Trend direction, shown with an arrow
trendValuestring—Trend text, e.g. "+12.5%"
loadingbooleanfalseShow a skeleton instead of the value
size'sm' | 'md' | 'lg''md'Size variant
classNamestring—Additional CSS classes

StatisticCard

PropTypeDefaultDescription
title*string—Stat title
value*number—Numeric value
prefixReactNode—Content before value
suffixReactNode—Content after value
iconReactNode—Icon to display
variant'default' | 'primary' | 'success' | 'warning' | 'danger''default'Color variant
classNamestring—Additional CSS classes

CountUp

PropTypeDefaultDescription
end*number—Target number to count to
startnumber0Starting number
durationnumber2000Animation duration in ms
decimalsnumber0Number of decimal places

Usage

Import and implementation examples

import { Statistic, StatisticCard, CountUp } from '@/components/ui/statistic'
import { Users, TrendingUp } from 'lucide-react'
// Basic statistic
<Statistic
title="Active Users"
value={8249}
/>
// With prefix icon
<Statistic
title="Growth"
value={18.5}
prefix={<TrendingUp className="w-4 h-4" />}
suffix="%"
/>
// Statistic card with icon and variant
<StatisticCard
title="Total Revenue"
value={145678}
prefix="$"
variant="success"
/>
// Digits roll when value changes
<Statistic title="Active Users" value={users} animated />
// Animated counting on mount
<CountUp end={12847} duration={2000} />
<CountUp end={24.5} decimals={1} duration={2000} />

Features

Built-in functionality

  • 3 size variants: Small, medium, and large sizes
  • Prefix & suffix: Add icons, symbols, or units
  • CountUp animation: Animated number counting on mount
  • Rolling digits: animated rolls each digit on value change
  • StatisticCard: Card wrapper with description support
  • Number formatting: Automatic locale-aware formatting

Accessibility

Accessibility considerations

ARIA Attributes

Uses semantic structure for title and valueAnimated values have final value in DOMIcons are decorative with aria-hidden

Keyboard Navigation

KeyAction
N/AStatistic is not interactive

Notes

  • Screen readers announce title and value together
  • Under prefers-reduced-motion CountUp shows the end value at once and digits do not roll
  • Clear visual hierarchy maintained