Skip to content
OTF Kit logoOTF Kit

Animated Number

Display

Smooth animated number ticker — for stat counters and metric reveals.

View in Storybook
Animated Number
Loading Storybook preview…

Installation

bun add @otfdashkit/ui

Usage

Import Animated Number from @otfdashkit/ui.

Code
// Animated Number — Smooth animated number ticker — for stat counters and metric reveals.
//
// Install:
//   bun add @otfdashkit/ui

import { AnimatedNumber } from '@otfdashkit/ui'

export function Example() {
  return (
    <AnimatedNumber>
      {/* your content */}
    </AnimatedNumber>
  )
}

Props

Props declared in the AnimatedNumber source. Inherited HTML attributes are not listed.

PropTypeDefaultDescription
valuerequirednumberTarget value to animate to
autoStartbooleantrueWhether to start animating immediately or wait for intersection
decimalsnumber0Decimal places (default 0)
durationnumber1200Animation duration in ms (default 1200)
easing(t: number) => numberEasing function (default easeOutExpo)
formatbooleantrueFormat with locale grouping (e.g. 1,234)
fromnumber0Starting value (default 0)
localestringLocale for number formatting
prefixstring''Prefix string e.g. "$"
suffixstring''Suffix string e.g. "%" or "k"

Related