Number Ticker
more-shadcn-noair/number-tickerFreeComponent
An animated number counter using spring physics.
Live preview
live · rendered by the registry
Rendered by more-shadcn-noair on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://more-shadcn.noair.fun/r/number-ticker.jsonSource
1<script lang="ts">2 import { cn } from '$UTILS$';3 import { spring } from 'svelte/motion';4 import { onMount } from 'svelte';56 let {7 value = 0,8 initial = 0,9 duration = 1000,10 class: className11 }: {12 value: number;13 initial?: number;14 duration?: number;15 class?: string;16 } = $props();1718 const count = spring(initial, {19 stiffness: 0.1,20 damping: 0.421 });2223 let element: HTMLSpanElement;24 let isVisible = false;2526 onMount(() => {27 const observer = new IntersectionObserver(28 (entries) => {29 if (entries[0].isIntersecting && !isVisible) {30 isVisible = true;31 count.set(value);32 }33 },34 { threshold: 0.1 }35 );3637 if (element) observer.observe(element);3839 return () => observer.disconnect();40 });4142 let displayValue = $derived(Math.round($count).toLocaleString('en-US'));43</script>4445<span bind:this={element} class={cn('tabular-nums tracking-tight text-foreground', className)}>46 {displayValue}47</span>
What it pulls in
npm packages
More from more-shadcn-noair
All 43 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Audioaudio | more-shadcn-noair | Components | Free | no deps | |
| Audio Waveaudio-wave | more-shadcn-noair | Components | Free | no deps | |
| Autocompleteautocomplete | more-shadcn-noair | Components | Free | no deps | |
| Bannerbanner | more-shadcn-noair | Components | Free | no deps | |
| Big Calendarbig-calendar | more-shadcn-noair | Components | Free | no deps | |
| Bottom Navigationbottom-nav | more-shadcn-noair | Components | Free | no deps | |
| Canvascanvas | more-shadcn-noair | Components | Free | no deps | |
| Chipchip | more-shadcn-noair | Components | Free | no deps |
