Heroes JS behaviour

Spotlight hero

A centred hero on an ink-dark sky: three gradient blobs drift calmly while the halo of light travels with your pointer — badge over the title, two CTAs and a trust row under the buttons; the first screen lights the stage.

Documentation

Real scenarios

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

Asterly 3.0 — generally available

Ship with the lights on

Asterly puts every deploy in Frankfurt, Dublin and Singapore under one beam — traces, logs and releases on a single calm surface.

SOC 2 Type II 99.99% uptime SLA 4,200+ teams

Important props

Important props
Prop Type Default What it does
--hrsp-mx · --hrsp-my percentage '50 · 26' The spotlight position in percent; pointermove over the hero updates it, and on touch it rests at centre.
radius length '34rem' The halo radius; larger spreads a softer beam, smaller focuses the ray.
mesh layers '3' The count of background blobs; each a blurred ellipse on a 26–38s cycle.
reduced-motion media 'pause' Under prefers-reduced-motion the blobs freeze; the light still follows the pointer because it is the user’s hand.

Snippet

<section class="hrsp" x-data="{
        mx: 50, my: 26,
        track(e) {
            const r = this.$el.getBoundingClientRect();
            this.mx = (e.clientX - r.left) / r.width * 100;
            this.my = (e.clientY - r.top) / r.height * 100;
        },
    }"
    x-on:pointermove="track($event)"
    :style="`--hrsp-mx:${mx}%; --hrsp-my:${my}%`">
    <i class="hrsp-blob" aria-hidden="true"></i>
    <i class="hrsp-blob" aria-hidden="true"></i>
    <div class="hrsp-light" aria-hidden="true"></div>

    <span class="hrsp-badge"><i>✦</i> Asterly 3.0 is generally available</span>
    <h1 class="hrsp-title">Ship with the lights on</h1>
    <p class="hrsp-sub">Asterly puts every deploy in Frankfurt, Dublin and Singapore under the beam.</p>
    <div class="hrsp-ctas">
        <button class="hrsp-btn">Start free</button>
        <button class="hrsp-btn hrsp-btn-ghost">Watch the 4-min tour</button>
    </div>
    <p class="hrsp-trust">SOC 2 · 99.99% uptime · 4,200+ teams</p>
</section>

<style>
.hrsp { position: relative; overflow: clip; padding: 6rem 1.5rem; text-align: center;
        background: #0b1020; color: #eef1ff; }
.hrsp-light { position: absolute; inset: 0; pointer-events: none;
        background: radial-gradient(34rem circle at var(--hrsp-mx, 50%) var(--hrsp-my, 26%),
        #8ea2ff33, #8ea2ff0d 45%, transparent 70%); }
.hrsp-blob { position: absolute; inline-size: 30rem; aspect-ratio: 1; filter: blur(90px);
        border-radius: 50%; background: #4f46e5; opacity: .35;
        animation: hrsp-drift 30s ease-in-out infinite alternate; }
@keyframes hrsp-drift { to { translate: 8rem -4rem; scale: 1.15; } }
@media (prefers-reduced-motion: reduce) { .hrsp-blob { animation: none; } }
</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 SpotlightHero from '@/components/heroes/SpotlightHero';

export default function Landing() {
  return (
    <NabuXUIProvider locale="en" linkComponent={Link}>
      <SpotlightHero />
    </NabuXUIProvider>
  );
}
// SpotlightHero.jsx — centred hero, halo follows the pointer
import { useRef, useState } from 'react';

export default function SpotlightHero() {
  const stage = useRef(null);
  const [beam, setBeam] = useState({ x: 50, y: 26 });

  const track = (e) => {
    const r = stage.current.getBoundingClientRect();
    setBeam({ x: ((e.clientX - r.left) / r.width) * 100, y: ((e.clientY - r.top) / r.height) * 100 });
  };

  return (
    <>
      <style>{`
        .hrsp { position: relative; overflow: clip; padding: 6rem 1.5rem; text-align: center;
                background: #0b1020; color: #eef1ff; }
        .hrsp-light { position: absolute; inset: 0; pointer-events: none;
                background: radial-gradient(34rem circle at ${beam.x}% ${beam.y}%,
                #8ea2ff33, #8ea2ff0d 45%, transparent 70%); }
        .hrsp-blob { position: absolute; inline-size: 30rem; aspect-ratio: 1; filter: blur(90px);
                border-radius: 50%; background: #4f46e5; opacity: .35;
                animation: hrsp-drift 30s ease-in-out infinite alternate; }
        @keyframes hrsp-drift { to { translate: 8rem -4rem; scale: 1.15; } }
        .hrsp-title { font: 700 clamp(2.25rem, 6vw, 4.5rem)/1.05 system-ui; margin: 1rem 0; }
        .hrsp-ctas { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; }
        @media (prefers-reduced-motion: reduce) { .hrsp-blob { animation: none; } }
      `}</style>
      <section className="hrsp" ref={stage} onPointerMove={track}>
        <i className="hrsp-blob" aria-hidden="true" />
        <i className="hrsp-blob" aria-hidden="true" />
        <div className="hrsp-light" aria-hidden="true" />
        <span className="hrsp-badge">✦ Asterly 3.0 is generally available</span>
        <h1 className="hrsp-title">Ship with the lights on</h1>
        <p className="hrsp-sub">Every deploy in Frankfurt, Dublin and Singapore under the beam.</p>
        <div className="hrsp-ctas">
          <button className="hrsp-btn">Start free</button>
          <button className="hrsp-btn hrsp-btn-ghost">Watch the 4-min tour</button>
        </div>
      </section>
    </>
  );
}
<!-- SpotlightHero.vue — centred hero, halo follows the pointer -->
<script setup>
import { ref } from 'vue';

const stage = ref(null);
const beam = ref({ x: 50, y: 26 });

function track(e) {
  const r = stage.value.getBoundingClientRect();
  beam.value = { x: ((e.clientX - r.left) / r.width) * 100, y: ((e.clientY - r.top) / r.height) * 100 };
}
</script>

<template>
  <section class="hrsp" ref="stage" @pointermove="track"
           :style="{ '--hrsp-mx': beam.x + '%', '--hrsp-my': beam.y + '%' }">
    <i class="hrsp-blob" aria-hidden="true"></i>
    <i class="hrsp-blob" aria-hidden="true"></i>
    <div class="hrsp-light" aria-hidden="true"></div>
    <span class="hrsp-badge">✦ Asterly 3.0 is generally available</span>
    <h1 class="hrsp-title">Ship with the lights on</h1>
    <p class="hrsp-sub">Every deploy in Frankfurt, Dublin and Singapore under the beam.</p>
    <div class="hrsp-ctas">
      <button class="hrsp-btn">Start free</button>
      <button class="hrsp-btn hrsp-btn-ghost">Watch the 4-min tour</button>
    </div>
  </section>
</template>

<style scoped>
.hrsp { position: relative; overflow: clip; padding: 6rem 1.5rem; text-align: center;
        background: #0b1020; color: #eef1ff; }
.hrsp-light { position: absolute; inset: 0; pointer-events: none;
        background: radial-gradient(34rem circle at var(--hrsp-mx, 50%) var(--hrsp-my, 26%),
        #8ea2ff33, #8ea2ff0d 45%, transparent 70%); }
.hrsp-blob { position: absolute; inline-size: 30rem; aspect-ratio: 1; filter: blur(90px);
        border-radius: 50%; background: #4f46e5; opacity: .35;
        animation: hrsp-drift 30s ease-in-out infinite alternate; }
@keyframes hrsp-drift { to { translate: 8rem -4rem; scale: 1.15; } }
</style>
<!-- SpotlightHero.svelte — centred hero, halo follows the pointer -->
<script>
  let stage;
  let beam = $state({ x: 50, y: 26 });

  function track(e) {
    const r = stage.getBoundingClientRect();
    beam = { x: ((e.clientX - r.left) / r.width) * 100, y: ((e.clientY - r.top) / r.height) * 100 };
  }
</script>

<section class="hrsp" bind:this={stage} onpointermove={track}
         style={`--hrsp-mx:${beam.x}%; --hrsp-my:${beam.y}%`}>
  <i class="hrsp-blob" aria-hidden="true"></i>
  <i class="hrsp-blob" aria-hidden="true"></i>
  <div class="hrsp-light" aria-hidden="true"></div>
  <span class="hrsp-badge">✦ Asterly 3.0 is generally available</span>
  <h1 class="hrsp-title">Ship with the lights on</h1>
  <p class="hrsp-sub">Every deploy in Frankfurt, Dublin and Singapore under the beam.</p>
  <div class="hrsp-ctas">
    <button class="hrsp-btn">Start free</button>
    <button class="hrsp-btn hrsp-btn-ghost">Watch the 4-min tour</button>
  </div>
</section>

<style>
.hrsp { position: relative; overflow: clip; padding: 6rem 1.5rem; text-align: center;
        background: #0b1020; color: #eef1ff; }
.hrsp-light { position: absolute; inset: 0; pointer-events: none;
        background: radial-gradient(34rem circle at var(--hrsp-mx, 50%) var(--hrsp-my, 26%),
        #8ea2ff33, #8ea2ff0d 45%, transparent 70%); }
.hrsp-blob { position: absolute; inline-size: 30rem; aspect-ratio: 1; filter: blur(90px);
        border-radius: 50%; background: #4f46e5; opacity: .35;
        animation: hrsp-drift 30s ease-in-out infinite alternate; }
@keyframes hrsp-drift { to { translate: 8rem -4rem; scale: 1.15; } }
</style>