Stats Counter

An animated counter that increments from zero (or a start value) to a target number.

Install

npx @vultra/cli add stats-counter

Usage

<script>
  import { StatsCounter } from '@vultra/ui';
</script>

<StatsCounter value={12345} duration={2000} />

Props

PropTypeDefaultDescription
valuenumber0Target number to animate to
startnumber0Starting number
durationnumber1500Animation duration in ms
separatorbooleantrueAdd thousand separators
prefixstringPrefix (e.g. $)
suffixstringSuffix (e.g. %)
decimalsnumber0Decimal places
classstring-Additional CSS classes

Notes

  • Animates when the element enters the viewport (Intersection Observer).
  • Re-animates when the value prop changes.
  • Use for hero sections, dashboards, and landing pages.