asafefe.dev

Number Ticker

A number that counts up with an ease-out curve when scrolled into view.

motionutils@soultel/use-reduced-motion-safe
0

Installation

$ pnpm dlx shadcn@latest add @soultel/number-ticker

No namespace set up? npx shadcn@latest add https://asafefe.dev/r/number-ticker.json works too.

Manual installation
  1. 1. Install the dependencies.
    terminal1 lines
    npm install motion
  2. 2. Copy the source from the Code tab into components/number-ticker.tsx.

Usage

example.tsx5 lines
import { NumberTicker } from "@/components/number-ticker"

export function Example() {
  return <NumberTicker value={2847} />
}

Props

PropTypeDefaultDescription
valuenumber-Target value.
fromnumber0Starting value.
durationnumber1400Count duration in ms.
format"locale" | "plain""locale"Thousands separators or raw digits.