Number Ticker

Animate numbers to count up or down to a target number

motion-sv
0

Installation

pnpm dlx shadcn-svelte@latest add https://sv-animations.vercel.app/r/number-ticker.json

Usage

<script lang="ts">	import { NumberTicker } from "#lib/components/magic/number-ticker/index.js";</script>
<NumberTicker value={100} />

Examples

With Decimal Places

0.00

With Start Value

80

With Prefix and Suffix

$ 70.00 USD

Trigger On View (without once)

0.00

Props

Number Ticker

A component for animating numbers to count up or down to a target value.

NameTypeDefaultDescription
valuenumberundefinedThe target number to animate to.
startValuenumber0The starting number for the animation.
direction"up" | "down""up"The direction of the animation.
delaynumber0Delay before starting the animation in seconds.
decimalPlacesnumber0Number of decimal places to display.
classClassValue""Additional CSS classes to apply.
prefixstring""Prefix to display before the number.
suffixstring""Suffix to display after the number.
oncebooleantrueWhether to animate only the first time the component comes into view.