Heroes JS behaviour

Stats hero

Title and an inline email form with validation and a button in one pill; beneath, three big odometer counters rolling to their values plus a verified badge — all on a calm dotted background that makes the numbers feel sworn.

Documentation

Real scenarios

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

Measured quarterly · Northgate Audit

The numbers behind calm releases

Asterly runs the rollout layer for teams in 40+ countries — measured, audited and awake while you sleep.

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 % uptime SLA
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 ms p50 edge latency
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 k rollouts each day
SOC 2 Type II · ISO 27001 · independently verified, 2026

Important props

Important props
Prop Type Default What it does
reel translate '-1em × digit' Each digit is a vertical reel of ten glyphs reaching its digit by translate; separators stay static.
stagger ms '120' Each reel turns 120ms after its neighbour for a real counting feel; the replay button counts again.
validation event 'submit · live' The email is checked as you type; an error shakes the pill with a message, success swaps the form to its confirmation.
dots background '1px · 1.4rem grid' A calm dot grid with a soft radial highlight; motionless so the number does the talking.

Snippet

<section class="hrst" x-data="{
        run: false, digits: [[9, 9, 9, 9], [4, 2], [2, 4]],
        start() { this.run = true },
    }" x-init="setTimeout(start, 200)">
    <h1 class="hrst-title">The numbers behind calm releases</h1>

    <form class="hrst-pill" x-on:submit.prevent="email.includes('@') ? done = true : shake()">
        <input type="email" x-model="email" placeholder="you@team.com">
        <button>Start free</button>
    </form>

    <div class="hrst-stats">
        <template x-for="(group, g) in digits" :key="g">
            <div class="hrst-stat">
                <b class="hrst-num" dir="ltr">
                    <template x-for="(d, i) in group" :key="i">
                        <span class="hrst-reel" :style="`translate: 0 ${-(run ? d : 0)}em; transition-delay: ${i * 120}ms`">
                            <i>0</i><i>1</i><i>2</i><i>3</i><i>4</i><i>5</i><i>6</i><i>7</i><i>8</i><i>9</i>
                        </span>
                    </template>
                </b>
                <small>label</small>
            </div>
        </template>
    </div>
</section>

<style>
.hrst { display: grid; gap: 1.5rem; justify-items: center; text-align: center; padding: 5rem 1.25rem;
        background-image: radial-gradient(#12152b1f 1px, transparent 1.4px);
        background-size: 1.4rem 1.4rem; }
.hrst-pill { display: flex; gap: .5rem; padding: .4rem; border-radius: 999px;
        background: #fff; border: 1px solid #e3e6f5; box-shadow: 0 12px 30px #0b10201a; }
.hrst-num { display: inline-flex; font-size: clamp(2.5rem, 6vw, 4rem); line-height: 1; }
.hrst-reel { display: inline-block; overflow: clip; block-size: 1em;
        transition: translate 1.2s cubic-bezier(.2,.7,.2,1); }
.hrst-reel i { display: block; block-size: 1em; font-style: normal; }
@media (prefers-reduced-motion: reduce) { .hrst-reel { transition-duration: .01ms; } }
</style>
// resources/js/Pages/Landing.jsx — the Inertia (React) page; renders the
// React snippet below unchanged inside the app’s provider.
import { Link } from '@inertiajs/react';
import { NabuXUIProvider } from '@nabuxai/ui-react';
import StatsHero from '@/components/heroes/StatsHero';

export default function Landing() {
  return (
    <NabuXUIProvider locale="en" linkComponent={Link}>
      <StatsHero />
    </NabuXUIProvider>
  );
}
// StatsHero.jsx — inline email form + odometer counters
import { useEffect, useState } from 'react';

const GLYPHS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];

function Reel({ digit, delay, run }) {
  return (
    <span className="hrst-reel" style={{ translate: `0 ${-(run ? digit : 0)}em`, transitionDelay: `${delay}ms` }}>
      {GLYPHS.map((g) => <i key={g}>{g}</i>)}
    </span>
  );
}

export default function StatsHero() {
  const [email, setEmail] = useState('');
  const [done, setDone] = useState(false);
  const [shake, setShake] = useState(false);
  const [run, setRun] = useState(false);

  useEffect(() => { const t = setTimeout(() => setRun(true), 200); return () => clearTimeout(t); }, []);

  const submit = (e) => {
    e.preventDefault();
    if (email.includes('@')) setDone(true);
    else { setShake(true); setTimeout(() => setShake(false), 400); }
  };

  const stats = [
    { digits: [9, 9, 9, 9], glue: '.', suffix: '%', label: 'uptime SLA' },
    { digits: [4, 2], glue: '', suffix: 'ms', label: 'p50 edge latency' },
    { digits: [2, 4], glue: '', suffix: 'k', label: 'rollouts each day' },
  ];

  return (
    <>
      <style>{`
        .hrst { display: grid; gap: 1.5rem; justify-items: center; text-align: center; padding: 5rem 1.25rem;
                background-image: radial-gradient(#12152b1f 1px, transparent 1.4px); background-size: 1.4rem 1.4rem; }
        .hrst-pill { display: flex; gap: .5rem; padding: .4rem; border-radius: 999px; background: #fff;
                border: 1px solid #e3e6f5; box-shadow: 0 12px 30px #0b10201a; }
        .hrst-pill input { border: none; outline: none; padding: 0 .75rem; inline-size: min(58vw, 16rem); background: none; }
        .hrst-stats { display: flex; flex-wrap: wrap; gap: 2.5rem 4rem; justify-content: center; }
        .hrst-num { display: inline-flex; font: 800 clamp(2.5rem, 6vw, 4rem)/1 system-ui;
                font-variant-numeric: tabular-nums; }
        .hrst-reel { display: inline-block; overflow: clip; block-size: 1em;
                transition: translate 1.2s cubic-bezier(.2,.7,.2,1); }
        .hrst-reel i { display: block; block-size: 1em; font-style: normal; }
        .hrst-shake { animation: hrst-shake .4s; }
        @keyframes hrst-shake { 25% { translate: -.4rem 0; } 75% { translate: .4rem 0; } }
        @media (prefers-reduced-motion: reduce) { .hrst-reel { transition-duration: .01ms; } }
      `}</style>
      <section className="hrst">
        <h1 className="hrst-title">The numbers behind calm releases</h1>
        {done ? (
          <p role="status">You’re on the list — see you in the inbox, <b>{email}</b>.</p>
        ) : (
          <form className={`hrst-pill ${shake ? 'hrst-shake' : ''}`} onSubmit={submit}>
            <input type="email" value={email} onChange={(e) => setEmail(e.target.value)} placeholder="you@team.com" />
            <button type="submit">Start free</button>
          </form>
        )}
        <div className="hrst-stats">
          {stats.map((s) => (
            <div className="hrst-stat" key={s.label}>
              <b className="hrst-num">
                {s.digits.map((d, i) => (
                  <span key={`${s.label}-${i}`} style={{ display: 'inline-flex' }}>
                    <Reel digit={d} delay={i * 120} run={run} />
                    {i === 0 && s.glue && <span>{s.glue}</span>}
                  </span>
                ))}
                <small>{s.suffix}</small>
              </b>
              <small className="hrst-label">{s.label}</small>
            </div>
          ))}
        </div>
      </section>
    </>
  );
}
<!-- StatsHero.vue — inline email form + odometer counters -->
<script setup>
import { onMounted, ref } from 'vue';

const email = ref('');
const done = ref(false);
const shake = ref(false);
const run = ref(false);
const glyphs = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
const stats = [
  { digits: [9, 9, 9, 9], glue: '.', suffix: '%', label: 'uptime SLA' },
  { digits: [4, 2], glue: '', suffix: 'ms', label: 'p50 edge latency' },
  { digits: [2, 4], glue: '', suffix: 'k', label: 'rollouts each day' },
];

onMounted(() => setTimeout(() => (run.value = true), 200));

function submit() {
  if (email.value.includes('@')) done.value = true;
  else { shake.value = true; setTimeout(() => (shake.value = false), 400); }
}
</script>

<template>
  <section class="hrst">
    <h1 class="hrst-title">The numbers behind calm releases</h1>
    <p v-if="done" role="status">You’re on the list — see you in the inbox, <b>{{ email }}</b>.</p>
    <form v-else class="hrst-pill" :class="{ 'hrst-shake': shake }" @submit.prevent="submit">
      <input type="email" v-model="email" placeholder="you@team.com" />
      <button type="submit">Start free</button>
    </form>
    <div class="hrst-stats">
      <div v-for="s in stats" :key="s.label" class="hrst-stat">
        <b class="hrst-num">
          <template v-for="(d, i) in s.digits" :key="i">
            <span class="hrst-reel" :style="{ translate: `0 ${-(run ? d : 0)}em`, transitionDelay: `${i * 120}ms` }">
              <i v-for="g in glyphs" :key="g">{{ g }}</i>
            </span>
            <span v-if="i === 0 && s.glue">{{ s.glue }}</span>
          </template>
          <small>{{ s.suffix }}</small>
        </b>
        <small class="hrst-label">{{ s.label }}</small>
      </div>
    </div>
  </section>
</template>

<style scoped>
.hrst { display: grid; gap: 1.5rem; justify-items: center; text-align: center; padding: 5rem 1.25rem;
        background-image: radial-gradient(#12152b1f 1px, transparent 1.4px); background-size: 1.4rem 1.4rem; }
.hrst-pill { display: flex; gap: .5rem; padding: .4rem; border-radius: 999px; background: #fff;
        border: 1px solid #e3e6f5; box-shadow: 0 12px 30px #0b10201a; }
.hrst-pill input { border: none; outline: none; padding: 0 .75rem; inline-size: min(58vw, 16rem); background: none; }
.hrst-stats { display: flex; flex-wrap: wrap; gap: 2.5rem 4rem; justify-content: center; }
.hrst-num { display: inline-flex; font: 800 clamp(2.5rem, 6vw, 4rem)/1 system-ui;
        font-variant-numeric: tabular-nums; }
.hrst-reel { display: inline-block; overflow: clip; block-size: 1em;
        transition: translate 1.2s cubic-bezier(.2,.7,.2,1); }
.hrst-reel i { display: block; block-size: 1em; font-style: normal; }
.hrst-shake { animation: hrst-shake .4s; }
@keyframes hrst-shake { 25% { translate: -.4rem 0; } 75% { translate: .4rem 0; } }
</style>
<!-- StatsHero.svelte — inline email form + odometer counters -->
<script>
  const glyphs = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
  const stats = [
    { digits: [9, 9, 9, 9], glue: '.', suffix: '%', label: 'uptime SLA' },
    { digits: [4, 2], glue: '', suffix: 'ms', label: 'p50 edge latency' },
    { digits: [2, 4], glue: '', suffix: 'k', label: 'rollouts each day' },
  ];
  let email = $state('');
  let done = $state(false);
  let shake = $state(false);
  let run = $state(false);

  $effect(() => { const t = setTimeout(() => (run = true), 200); return () => clearTimeout(t); });

  function submit(e) {
    e.preventDefault();
    if (email.includes('@')) done = true;
    else { shake = true; setTimeout(() => (shake = false), 400); }
  }
</script>

<section class="hrst">
  <h1 class="hrst-title">The numbers behind calm releases</h1>
  {#if done}
    <p role="status">You’re on the list — see you in the inbox, <b>{email}</b>.</p>
  {:else}
    <form class="hrst-pill" class:hrst-shake={shake} onsubmit={submit}>
      <input type="email" bind:value={email} placeholder="you@team.com" />
      <button type="submit">Start free</button>
    </form>
  {/if}
  <div class="hrst-stats">
    {#each stats as s (s.label)}
      <div class="hrst-stat">
        <b class="hrst-num">
          {#each s.digits as d, i (i)}
            <span class="hrst-reel" style={`translate: 0 ${-(run ? d : 0)}em; transition-delay: ${i * 120}ms`}>
              {#each glyphs as g (g)}<i>{g}</i>{/each}
            </span>
            {#if i === 0 && s.glue}<span>{s.glue}</span>{/if}
          {/each}
          <small>{s.suffix}</small>
        </b>
        <small class="hrst-label">{s.label}</small>
      </div>
    {/each}
  </div>
</section>

<style>
.hrst { display: grid; gap: 1.5rem; justify-items: center; text-align: center; padding: 5rem 1.25rem;
        background-image: radial-gradient(#12152b1f 1px, transparent 1.4px); background-size: 1.4rem 1.4rem; }
.hrst-pill { display: flex; gap: .5rem; padding: .4rem; border-radius: 999px; background: #fff;
        border: 1px solid #e3e6f5; box-shadow: 0 12px 30px #0b10201a; }
.hrst-pill input { border: none; outline: none; padding: 0 .75rem; inline-size: min(58vw, 16rem); background: none; }
.hrst-stats { display: flex; flex-wrap: wrap; gap: 2.5rem 4rem; justify-content: center; }
.hrst-num { display: inline-flex; font: 800 clamp(2.5rem, 6vw, 4rem)/1 system-ui;
        font-variant-numeric: tabular-nums; }
.hrst-reel { display: inline-block; overflow: clip; block-size: 1em;
        transition: translate 1.2s cubic-bezier(.2,.7,.2,1); }
.hrst-reel i { display: block; block-size: 1em; font-style: normal; }
.hrst-shake { animation: hrst-shake .4s; }
@keyframes hrst-shake { 25% { translate: -.4rem 0; } 75% { translate: .4rem 0; } }
</style>