Number that counts up to its value when it scrolls into view, with thousands separators, decimals, and a prefix or suffix.
- Downloads
- 12,480
- Uptime
- 99.9%
- Revenue
- $84,200
- Downloads
- 12,480
- Uptime
- 99.9%
- Revenue
- $84,200
- Downloads
- 12,480
- Uptime
- 99.9%
- Revenue
- $84,200
- Downloads
- 12,480
- Uptime
- 99.9%
- Revenue
- $84,200
- Downloads
12,480 - Uptime
99.9% - Revenue
$84,200
Examples
Revenue card
Monthly revenue
+12.5%$48,920.50
Compared to $43,480.00 last month
Monthly revenue
+12.5%$48,920.50
Compared to $43,480.00 last month
Monthly revenue
+12.5%$48,920.50
Compared to $43,480.00 last month
Monthly revenue
+12.5%$48,920.50
Compared to $43,480.00 last month
Monthly revenue
+12.5%Compared to $43,480.00 last month
<div class="rounded-xl border border-line bg-surface p-5">
<div class="flex items-center justify-between">
<p class="text-sm font-medium text-muted">Monthly revenue</p>
<span class="rounded-full bg-success/10 px-2 py-0.5 text-xs font-medium text-ink">+12.5%</span>
</div>
<p class="mt-3 text-4xl font-semibold tracking-tight text-ink">
<x-markas.number-ticker :value="48920.5" :decimals="2" prefix="$" />
</p>
<p class="mt-2 text-sm text-muted">Compared to $43,480.00 last month</p>
</div>Hero stat
25,000+
teams ship their interfaces with MarkasUI
25,000+
teams ship their interfaces with MarkasUI
25,000+
teams ship their interfaces with MarkasUI
25,000+
teams ship their interfaces with MarkasUI
teams ship their interfaces with MarkasUI
<div class="py-4 text-center">
<p class="text-5xl font-semibold tracking-tight text-ink">
<x-markas.number-ticker :value="25000" suffix="+" />
</p>
<p class="mt-2 text-sm text-muted">
teams ship their interfaces with MarkasUI
</p>
</div><script lang="ts">
import NumberTicker from "$lib/components/markas/NumberTicker.svelte";
</script>
<div class="py-4 text-center">
<p class="text-5xl font-semibold tracking-tight text-ink">
<NumberTicker value={25000} suffix="+" />
</p>
<p class="mt-2 text-sm text-muted">
teams ship their interfaces with MarkasUI
</p>
</div>---
import NumberTicker from "@/components/markas/NumberTicker.astro";
---
<div class="py-4 text-center">
<p class="text-5xl font-semibold tracking-tight text-ink">
<NumberTicker value={25000} suffix="+" />
</p>
<p class="mt-2 text-sm text-muted">teams ship their interfaces with MarkasUI</p>
</div>Counting down
Seats left for the workshop
Registration closes on 20 November
Seats left for the workshop
Registration closes on 20 November
Seats left for the workshop
Registration closes on 20 November
Seats left for the workshop
Registration closes on 20 November
Seats left for the workshop
Registration closes on 20 November
<div class="flex items-center gap-4 rounded-xl border border-line bg-surface p-4">
<div class="flex size-14 shrink-0 items-center justify-center rounded-lg bg-danger/10 text-xl font-semibold text-danger">
<x-markas.number-ticker :value="12" :from="100" :duration="2500" />
</div>
<div>
<p class="text-sm font-medium text-ink">Seats left for the workshop</p>
<p class="mt-0.5 text-sm text-muted">Registration closes on 20 November</p>
</div>
</div>Installation
npx markasui@latest add number-tickerpnpm dlx markasui@latest add number-tickeryarn dlx markasui@latest add number-tickerbunx --bun markasui@latest add number-ticker- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Install the dependency:
npm install alpinejs - Copy the component source below to
resources/views/components/markas/number-ticker.blade.php.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/NumberTicker.tsx.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/NumberTicker.vue.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/lib/components/markas/NumberTicker.svelte.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/NumberTicker.astro.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/app/markas/number-ticker.component.ts.
Usage
<p class="text-4xl font-semibold">
<x-markas.number-ticker :value="84200" prefix="$" />
</p>
<x-markas.number-ticker :value="99.9" :decimals="1" suffix="%" />
<x-markas.number-ticker :value="12" :from="100" />import { NumberTicker } from "@/components/markas/NumberTicker";
<p className="text-4xl font-semibold">
<NumberTicker value={84200} prefix="$" />
</p>
<NumberTicker value={99.9} decimals={1} suffix="%" />
<NumberTicker value={12} from={100} /><template>
<p class="text-4xl font-semibold">
<NumberTicker :value="84200" prefix="$" />
</p>
<NumberTicker :value="99.9" :decimals="1" suffix="%" />
<NumberTicker :value="12" :from="100" />
</template><script lang="ts">
import NumberTicker from "$lib/components/markas/NumberTicker.svelte";
</script>
<p class="text-4xl font-semibold">
<NumberTicker value={84200} prefix="$" />
</p>
<NumberTicker value={99.9} decimals={1} suffix="%" />---
import NumberTicker from "@/components/markas/NumberTicker.astro";
---
<p class="text-4xl font-semibold">
<NumberTicker value={84200} prefix="$" />
</p>
<NumberTicker value={12} from={100} />import { Component } from "@angular/core";
import { NumberTicker } from "./markas/number-ticker.component";
@Component({
selector: "app-revenue",
imports: [NumberTicker],
template: `
<p class="text-4xl font-semibold">
<span markas-number-ticker [value]="revenue" prefix="$"></span>
</p>
<span markas-number-ticker value="99.9" decimals="1" suffix="%"></span>
`,
})
export class Revenue {
revenue = 84200;
}- The count starts the first time the number scrolls into view and eases out toward the end.
- The server renders the final value, so the number is correct without JavaScript and for search engines.
- Formatting uses
Intl.NumberFormatwithlocale(defaulten-US). The Blade version needs Alpine.js. - With reduced motion, the final value is shown immediately.
Props
| Name | Type | Default | Description |
|---|---|---|---|
value | number | - | Final number. Changing it later counts from the current number to the new one. |
from | number | 0 | Starting number. Set it higher than value to count down. |
duration | number | 2000 | Length of the count in milliseconds. |
decimals | number | 0 | Number of decimal places shown. |
locale | string | en-US | Locale for Intl.NumberFormat, such as id-ID for dots as thousands separators. |
prefix | string | '' | Text before the number, such as $. |
suffix | string | '' | Text after the number, such as % or +. |
Accessibility
- Screen readers get the final value from a visually hidden copy; the counting digits are aria-hidden.
- An invisible copy of the final value reserves the width, so the layout does not shift while counting.
- With reduced motion, the final value is shown right away.
Related components
More animations components with the same classes in every framework.
- Avatar GroupOverlapping stack of avatars that spreads out on hover, shows each name in a tooltip, and collapses extra people into a +N chip.
- Letter SwapText whose letters slide out and back in with a stagger when its link or button is hovered or focused. Forward, ping-pong, or shuffled order.
- MarqueeEndless horizontal or vertical scroll of any content, with faded edges, reverse direction, and a pause on hover or focus.
- Scroll ProgressThin bar at the top of the page or a scrolling container that fills as the reader scrolls.
- Spotlight CardCard with a soft radial light that follows the pointer and a border that glows near it. Lights up on keyboard focus too.
- Text HighlighterA highlight that draws behind inline text from four directions: in view, on hover or focus, on mount, or on command. Solid, marker, underline, or gradient.