Landing sections JS behaviour

Stats band

A full-width dark band with a fine dot texture and four big counters that count from zero the moment they enter view — each with a line icon and a small label; reduced motion settles straight on the final number.

Documentation

Real scenarios

The component as it is used in a product — not a specimen grid.

Beacon in numbers

The scale your mornings rely on

%

measured uptime

B

events a day

countries served

+

teams on board

Rolling 90-day average across 34 regions · audited October 2026

Important props

Important props
Prop Type Default What it does
trigger IntersectionObserver 'threshold 0.25 · once' Counting starts the first time the band is seen; the observer disconnects after and never restarts.
easing curve 'easeOutCubic · 1400ms' The count eases out to its value; the decimals (99.99, 3.4) count along with their fraction digits.
decimals · suffix format '2 · %' Each number carries its own decimals and suffix; in Persian the digits, the decimal mark «٫» and the thousands separator «٬» all localise.
texture background 'dots · 22px' The one-pixel radial-gradient dot grid over deep navy; the band stays dark in both themes — dark is its identity.
reduced-motion media 'final value' Under prefers-reduced-motion the count is skipped and the final value shows instantly.

Snippet

<section class="secst" x-data="{
        vals: [0, 0, 0, 0],
        fmt(v, dec) { return dec ? v.toFixed(dec) : Math.round(v).toLocaleString('en-US'); },
        snap() { this.vals = [99.99, 3.4, 142, 8200]; },
        start() { const T0 = performance.now(), DUR = 1400, TO = [99.99, 3.4, 142, 8200];
            const tick = (t) => { const p = Math.min(1, (t - T0) / DUR), e = 1 - Math.pow(1 - p, 3);
                this.vals = TO.map(x => x * e); if (p < 1) requestAnimationFrame(tick); };
            requestAnimationFrame(tick); },
    }"
    x-init="if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) { snap(); }
            else { const io = new IntersectionObserver((es) => { es.forEach((en) => {
                if (en.isIntersecting) { start(); io.disconnect(); } }); }, { threshold: .25 });
                io.observe($el); }">
    <!-- the counters run the first time the band enters the view -->
    <div class="secst-grid">
        <div class="secst-stat">
            <svg aria-hidden="true">…shield…</svg>
            <p class="secst-value"><span x-text="fmt(vals[0], 2)"></span><small>%</small></p>
            <small>measured uptime</small>
        </div>
    </div>
</section>

<style>
.secst { padding: 3rem 1.5rem; border-radius: 1.4rem; color: #F8FAFC;
         background: #0B1220 radial-gradient(rgba(148,163,184,.16) 1px, transparent 1.5px);
         background-size: auto, 22px 22px; }
.secst-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.secst-value { margin: 0; font: 800 clamp(2rem, 4.5vw, 3.25rem)/1 'Inter', sans-serif;
               letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.secst-stat:not(:first-child) { border-inline-start: 1px solid #1E293B; }
@media (max-width: 640px) { .secst-grid { grid-template-columns: repeat(2, 1fr); } }
</style>
// app/Pages/Scale.jsx — Inertia (React) page; renders the React
// snippet below unchanged, with Inertia's Link wired into the provider.
import { Link } from '@inertiajs/react';
import { NabuXUIProvider } from '@nabuxai/ui-react';
import StatsBand from '@/components/StatsBand';

export default function Scale() {
  return (
    <NabuXUIProvider locale="en" linkComponent={Link}>
      <main className="nx-page">
        <StatsBand />
      </main>
    </NabuXUIProvider>
  );
}
// StatsBand.jsx — counters that run once, the moment they scroll into view
import { useEffect, useRef, useState } from 'react';
import '@nabuxai/ui-core/css';

const STATS = [
  { id: 'uptime', to: 99.99, dec: 2, suffix: '%', label: 'measured uptime' },
  { id: 'events', to: 3.4, dec: 1, suffix: 'B', label: 'events a day' },
  { id: 'countries', to: 142, dec: 0, suffix: '', label: 'countries served' },
  { id: 'teams', to: 8200, dec: 0, suffix: '+', label: 'teams on board' },
];
const fmt = (v, dec) => (dec ? v.toFixed(dec) : Math.round(v).toLocaleString('en-US'));

export default function StatsBand() {
  const [vals, setVals] = useState(STATS.map(() => 0));
  const rootRef = useRef(null);
  const started = useRef(false);

  const run = () => {
    const t0 = performance.now(), DUR = 1400;
    const tick = (t) => {
      const p = Math.min(1, (t - t0) / DUR);
      const e = 1 - Math.pow(1 - p, 3); // easeOutCubic
      setVals(STATS.map((s) => s.to * e));
      if (p < 1) requestAnimationFrame(tick);
    };
    requestAnimationFrame(tick);
  };

  useEffect(() => {
    const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
    if (reduce) { setVals(STATS.map((s) => s.to)); return; }
    const io = new IntersectionObserver((entries) => {
      entries.forEach((en) => {
        if (en.isIntersecting && !started.current) { started.current = true; run(); io.disconnect(); }
      });
    }, { threshold: 0.25 });
    io.observe(rootRef.current);
    return () => io.disconnect();
  }, []);

  return (
    <>
      <style>{`
        .scs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 3rem 1.5rem;
               border-radius: 1.4rem; color: #F8FAFC; font: 400 .9375rem/1.5 'Inter', sans-serif;
               background: #0B1220 radial-gradient(rgba(148, 163, 184, .16) 1px, transparent 1.5px);
               background-size: auto, 22px 22px; }
        .scs-stat { display: grid; gap: .5rem; justify-items: center; text-align: center; padding: .5rem 1rem; }
        .scs-stat:not(:first-child) { border-inline-start: 1px solid #1E293B; }
        .scs-stat svg { inline-size: 1.5rem; block-size: 1.5rem; stroke: #7DD3FC; stroke-width: 1.75;
                        fill: none; stroke-linecap: round; stroke-linejoin: round; }
        .scs-value { margin: 0; font: 800 clamp(2rem, 4.5vw, 3.25rem)/1 'Inter', sans-serif;
                     letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
        .scs-value small { font-size: .45em; font-weight: 700; color: #7DD3FC; }
        .scs-stat > small { color: #94A3B8; }
        @media (max-width: 640px) { .scs { grid-template-columns: repeat(2, 1fr); row-gap: 2rem; }
          .scs-stat:nth-child(3) { border-inline-start: none; } }
      `}</style>
      <section className="scs" ref={rootRef}>
        {STATS.map((s, i) => (
          <div className="scs-stat" key={s.id}>
            <svg viewBox="0 0 24 24" aria-hidden="true">
              {s.id === 'uptime' && <><path d="M12 3l7 3v5c0 4.4-3 8.4-7 9.5C8 19.4 5 15.4 5 11V6l7-3z" /><path d="M9 11.5l2 2 4-4.5" /></>}
              {s.id === 'events' && <path d="M13 2.5L5 13.5h5.5L11 21.5l8-11h-5.5l-.5-8z" />}
              {s.id === 'countries' && <><circle cx="12" cy="12" r="8.5" /><path d="M3.5 12h17M12 3.5c2.6 2.4 4 5.3 4 8.5s-1.4 6.1-4 8.5c-2.6-2.4-4-5.3-4-8.5s1.4-6.1 4-8.5z" /></>}
              {s.id === 'teams' && <><circle cx="9" cy="8.5" r="3.5" /><path d="M3 19.5c.9-3.3 3.3-5 6-5s5.1 1.7 6 5" /><path d="M15.5 5.5a3.5 3.5 0 0 1 0 6.4" /></>}
            </svg>
            <p className="scs-value">{fmt(vals[i], s.dec)}{s.suffix && <small> {s.suffix}</small>}</p>
            <small>{s.label}</small>
          </div>
        ))}
      </section>
    </>
  );
}
<!-- StatsBand.vue — counters that run once, the moment they scroll into view -->
<script setup lang="ts">
import { onBeforeUnmount, onMounted, ref } from 'vue';
import '@nabuxai/ui-core/css';

const stats = [
  { id: 'uptime', to: 99.99, dec: 2, suffix: '%', label: 'measured uptime' },
  { id: 'events', to: 3.4, dec: 1, suffix: 'B', label: 'events a day' },
  { id: 'countries', to: 142, dec: 0, suffix: '', label: 'countries served' },
  { id: 'teams', to: 8200, dec: 0, suffix: '+', label: 'teams on board' },
];
const vals = ref(stats.map(() => 0));
const root = ref<HTMLElement | null>(null);
let io: IntersectionObserver | null = null;
const fmt = (v: number, dec: number) => (dec ? v.toFixed(dec) : Math.round(v).toLocaleString('en-US'));

const run = () => {
  const t0 = performance.now(), DUR = 1400;
  const tick = (t: number) => {
    const p = Math.min(1, (t - t0) / DUR);
    const e = 1 - Math.pow(1 - p, 3); // easeOutCubic
    vals.value = stats.map((s) => s.to * e);
    if (p < 1) requestAnimationFrame(tick);
  };
  requestAnimationFrame(tick);
};

onMounted(() => {
  if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
    vals.value = stats.map((s) => s.to);
    return;
  }
  io = new IntersectionObserver((entries) => {
    entries.forEach((en) => {
      if (en.isIntersecting && io) { run(); io.disconnect(); io = null; }
    });
  }, { threshold: 0.25 });
  if (root.value) io.observe(root.value);
});
onBeforeUnmount(() => io?.disconnect());
</script>

<template>
  <section ref="root" class="scs">
    <div v-for="s, i in stats" :key="s.id" class="scs-stat">
      <svg viewBox="0 0 24 24" aria-hidden="true">
        <template v-if="s.id === 'uptime'"><path d="M12 3l7 3v5c0 4.4-3 8.4-7 9.5C8 19.4 5 15.4 5 11V6l7-3z" /><path d="M9 11.5l2 2 4-4.5" /></template>
        <template v-else-if="s.id === 'events'"><path d="M13 2.5L5 13.5h5.5L11 21.5l8-11h-5.5l-.5-8z" /></template>
        <template v-else-if="s.id === 'countries'"><circle cx="12" cy="12" r="8.5" /><path d="M3.5 12h17M12 3.5c2.6 2.4 4 5.3 4 8.5s-1.4 6.1-4 8.5c-2.6-2.4-4-5.3-4-8.5s1.4-6.1 4-8.5z" /></template>
        <template v-else><circle cx="9" cy="8.5" r="3.5" /><path d="M3 19.5c.9-3.3 3.3-5 6-5s5.1 1.7 6 5" /><path d="M15.5 5.5a3.5 3.5 0 0 1 0 6.4" /></template>
      </svg>
      <p class="scs-value">{{ fmt(vals[i], s.dec) }}<small v-if="s.suffix"> {{ s.suffix }}</small></p>
      <small>{{ s.label }}</small>
    </div>
  </section>
</template>

<style scoped>
.scs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 3rem 1.5rem;
       border-radius: 1.4rem; color: #F8FAFC; font: 400 .9375rem/1.5 'Inter', sans-serif;
       background: #0B1220 radial-gradient(rgba(148, 163, 184, .16) 1px, transparent 1.5px);
       background-size: auto, 22px 22px; }
.scs-stat { display: grid; gap: .5rem; justify-items: center; text-align: center; padding: .5rem 1rem; }
.scs-stat:not(:first-child) { border-inline-start: 1px solid #1E293B; }
.scs-stat svg { inline-size: 1.5rem; block-size: 1.5rem; stroke: #7DD3FC; stroke-width: 1.75;
                fill: none; stroke-linecap: round; stroke-linejoin: round; }
.scs-value { margin: 0; font: 800 clamp(2rem, 4.5vw, 3.25rem)/1 'Inter', sans-serif;
             letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.scs-value small { font-size: .45em; font-weight: 700; color: #7DD3FC; }
.scs-stat > small { color: #94A3B8; }
@media (max-width: 640px) { .scs { grid-template-columns: repeat(2, 1fr); row-gap: 2rem; }
  .scs-stat:nth-child(3) { border-inline-start: none; } }
</style>
<!-- StatsBand.svelte — counters that run once, the moment they scroll into view -->
<script lang="ts">
  import { onMount } from 'svelte';
  import '@nabuxai/ui-core/css';

  const stats = [
    { id: 'uptime', to: 99.99, dec: 2, suffix: '%', label: 'measured uptime' },
    { id: 'events', to: 3.4, dec: 1, suffix: 'B', label: 'events a day' },
    { id: 'countries', to: 142, dec: 0, suffix: '', label: 'countries served' },
    { id: 'teams', to: 8200, dec: 0, suffix: '+', label: 'teams on board' },
  ];
  let vals = $state(stats.map(() => 0));
  let root: HTMLElement;
  const fmt = (v: number, dec: number) => (dec ? v.toFixed(dec) : Math.round(v).toLocaleString('en-US'));

  const run = () => {
    const t0 = performance.now(), DUR = 1400;
    const tick = (t: number) => {
      const p = Math.min(1, (t - t0) / DUR);
      const e = 1 - Math.pow(1 - p, 3); // easeOutCubic
      vals = stats.map((s) => s.to * e);
      if (p < 1) requestAnimationFrame(tick);
    };
    requestAnimationFrame(tick);
  };

  onMount(() => {
    if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
      vals = stats.map((s) => s.to);
      return;
    }
    const io = new IntersectionObserver((entries) => {
      entries.forEach((en) => {
        if (en.isIntersecting) { run(); io.disconnect(); }
      });
    }, { threshold: 0.25 });
    io.observe(root);
    return () => io.disconnect();
  });
</script>

<section class="scs" bind:this={root}>
  {#each stats as s, i (s.id)}
    <div class="scs-stat">
      <svg viewBox="0 0 24 24" aria-hidden="true">
        {#if s.id === 'uptime'}<path d="M12 3l7 3v5c0 4.4-3 8.4-7 9.5C8 19.4 5 15.4 5 11V6l7-3z" /><path d="M9 11.5l2 2 4-4.5" />
        {:else if s.id === 'events'}<path d="M13 2.5L5 13.5h5.5L11 21.5l8-11h-5.5l-.5-8z" />
        {:else if s.id === 'countries'}<circle cx="12" cy="12" r="8.5" /><path d="M3.5 12h17M12 3.5c2.6 2.4 4 5.3 4 8.5s-1.4 6.1-4 8.5c-2.6-2.4-4-5.3-4-8.5s1.4-6.1 4-8.5z" />
        {:else}<circle cx="9" cy="8.5" r="3.5" /><path d="M3 19.5c.9-3.3 3.3-5 6-5s5.1 1.7 6 5" /><path d="M15.5 5.5a3.5 3.5 0 0 1 0 6.4" />
        {/if}
      </svg>
      <p class="scs-value">{fmt(vals[i], s.dec)}{#if s.suffix}<small> {s.suffix}</small>{/if}</p>
      <small>{s.label}</small>
    </div>
  {/each}
</section>

<style>
.scs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 3rem 1.5rem;
       border-radius: 1.4rem; color: #F8FAFC; font: 400 .9375rem/1.5 'Inter', sans-serif;
       background: #0B1220 radial-gradient(rgba(148, 163, 184, .16) 1px, transparent 1.5px);
       background-size: auto, 22px 22px; }
.scs-stat { display: grid; gap: .5rem; justify-items: center; text-align: center; padding: .5rem 1rem; }
.scs-stat:not(:first-child) { border-inline-start: 1px solid #1E293B; }
.scs-stat svg { inline-size: 1.5rem; block-size: 1.5rem; stroke: #7DD3FC; stroke-width: 1.75;
                fill: none; stroke-linecap: round; stroke-linejoin: round; }
.scs-value { margin: 0; font: 800 clamp(2rem, 4.5vw, 3.25rem)/1 'Inter', sans-serif;
             letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.scs-value small { font-size: .45em; font-weight: 700; color: #7DD3FC; }
.scs-stat > small { color: #94A3B8; }
@media (max-width: 640px) { .scs { grid-template-columns: repeat(2, 1fr); row-gap: 2rem; }
  .scs-stat:nth-child(3) { border-inline-start: none; } }
</style>