Components

Number Counter

Digits that count up once when the number scrolls into view.

A stats counter with two playback modes. ScrollTrigger fires it once; Number Flow handles the digit spin. Driven by GSAP.

Instant

Rolls up to the target as soon as the number mounts. Pass instant.

New tab

0+

projects delivered

0%

client retention

0X

faster launch

Viewport

Holds at 0 until you scroll the number into view. In a nested scroll area, wrap the counters in [data-counter-scroller].

New tab

Scroll down

0+

projects delivered

0%

client retention

0X

faster launch

Installation

pnpm dlx shadcn@latest add @tween-ui/number-counter

Usage

app/page.tsx
app/page.tsx
import NumberCounter from '@/components/tweenui/scroll-based/number-counter';
 
export default function Page() {
  return (
    <p>
      <NumberCounter value={150} instant />+ projects delivered
    </p>
  );
}

Props

PropTypeDefaultDescription
valuenumber—Number to count to.
durationnumber1.8Count-up length in seconds.
delaynumber0Wait after the trigger before counting.
instantbooleanfalseSkip ScrollTrigger and play as soon as it mounts.
formatFormatgrouping onIntl-style options passed to Number Flow.

Accessibility

Under prefers-reduced-motion: reduce the final value appears immediately, with no digit roll. The count also runs once (once: true) so scrolling back does not replay it.