Relief Hero
A hero for an AI support desk over a wall of what customers write in about. The headline sits in a clearing the words make for it; every few seconds the topic that's spiking rises across the whole wall, rippling out from a readout that names it and how fast it's growing.
components/relief-hero.tsx
"use client";
import * as React from "react";
import { Relief } from "@/components/ui/relief";
/* ── Content ─────────────────────────────────────────────────
* Everything you'd change to make the hero yours: the nav, the
* headline, the two calls to action, the words on the wall and
* the spikes the readout walks through. Each spike raises its
* topic to full height and its neighbors part of the way, so
* the wall shows how far a spike reaches.
* ─────────────────────────────────────────────────────────── */
/** The brand red: the readout's dot and topic, the logo. Light and dark. */
const ACCENT = { light: "#d3123c", dark: "#ff4f81" };
/** The wall's inks, low to high: sorrel greens up to its red stems. */
const INKS = ["#06331f", "#00663a", "#00b25d", "#8ff0bd", "#f3fff8", "#ffc2d4", "#ff4f81", "#e0133f"];
const BRAND = { name: "Sorrel", href: "#" };
const NAV_LINKS = [
{ label: "Product", href: "#product" },
{ label: "Pricing", href: "#pricing" },
{ label: "Customers", href: "#customers" },
{ label: "Docs", href: "#docs" },
];
const SIGN_IN = { label: "Sign in", href: "#sign-in" };
const NAV_CTA = { label: "Start free", href: "#start" };
const HEADLINE = ["Read every ticket.", "See what's rising."];
const SUBLINE =
"Sorrel answers the routine questions in your helpdesk and maps the rest as they arrive, so a spike in refunds shows up an hour before it shows up in churn.";
const PRIMARY = { label: "Start a free trial", href: "#start" };
const SECONDARY = { label: "Book a demo", href: "#demo" };
/** What customers write in about: the wall. */
const TOPICS = [
"Refunds", "Returns", "Billing", "Invoice", "Login", "Password", "2FA", "Shipping", "Tracking", "Delivery",
"Damaged", "Exchange", "Sizes", "Discount", "Coupon", "Cancel", "Upgrade", "Seats", "Export", "Account",
"Address", "Gift card", "Warranty", "Stock", "Pickup", "Duties", "Points", "Email", "App", "Outage",
"Slow", "Sync", "Payment", "Card", "Charge", "Receipt", "Plans", "Trial", "Delete", "Privacy",
];
/** The spikes the readout walks through: the topic, how fast it's growing, and how far it reaches. */
const SPIKES: { topic: string; change: string; reach: Record<string, number> }[] = [
{ topic: "Refunds", change: "+38%", reach: { Returns: 0.62, Charge: 0.5, Billing: 0.38, Receipt: 0.3 } },
{ topic: "Login", change: "+52%", reach: { Password: 0.66, "2FA": 0.55, Account: 0.4, Email: 0.3 } },
{ topic: "Tracking", change: "+27%", reach: { Shipping: 0.6, Delivery: 0.5, Address: 0.34, Pickup: 0.28 } },
];
/** Milliseconds: the wave plays alone after load, then each spike holds this long. */
const CYCLE = { start: 1600, hold: 4200 };
/* ── Section ─────────────────────────────────────────────── */
const REDUCED = "(prefers-reduced-motion: reduce)";
const subscribeReduced = (onChange: () => void) => {
const query = window.matchMedia(REDUCED);
query.addEventListener("change", onChange);
return () => query.removeEventListener("change", onChange);
};
export function ReliefHero() {
const [spike, setSpike] = React.useState(-1);
// False on the server and in the hydration render, so the markup matches either way.
const reduced = React.useSyncExternalStore(subscribeReduced, () => window.matchMedia(REDUCED).matches, () => false);
const [playing, setPlaying] = React.useState(true);
const [inView, setInView] = React.useState(false);
const [origin, setOrigin] = React.useState<[number, number]>([0.5, 0.7]);
const wallRef = React.useRef<HTMLDivElement>(null);
const readoutRef = React.useRef<HTMLDivElement>(null);
// Spikes ripple out from the readout that names them.
React.useEffect(() => {
const measure = () => {
const wall = wallRef.current?.getBoundingClientRect();
const box = readoutRef.current?.getBoundingClientRect();
if (!wall || !box || !wall.width || !wall.height) return;
setOrigin([(box.left + box.width / 2 - wall.left) / wall.width, (box.top + box.height / 2 - wall.top) / wall.height]);
};
measure();
const ro = new ResizeObserver(measure);
if (wallRef.current) ro.observe(wallRef.current);
return () => ro.disconnect();
}, []);
React.useEffect(() => {
const wall = wallRef.current;
if (!wall) return;
const io = new IntersectionObserver(([entry]) => setInView(entry.isIntersecting), { threshold: 0.2 });
io.observe(wall);
return () => io.disconnect();
}, []);
// Spikes take turns while the hero is in view. Under reduced motion the first one stands still.
React.useEffect(() => {
if (reduced || !playing || !inView) return;
const timer = window.setTimeout(
() => setSpike((s) => (s + 1) % SPIKES.length),
spike < 0 ? CYCLE.start : CYCLE.hold,
);
return () => window.clearTimeout(timer);
}, [spike, playing, inView, reduced]);
const shown = reduced ? Math.max(spike, 0) : spike;
const current = shown >= 0 ? SPIKES[shown] : null;
const raise = React.useMemo(
() => (current ? { ...current.reach, [current.topic]: 1 } : null),
[current],
);
const ring =
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zinc-950 dark:focus-visible:outline-white";
return (
<section
style={{ "--accent": ACCENT.light, "--accent-dark": ACCENT.dark } as React.CSSProperties}
className="bg-white text-zinc-950 dark:bg-[#07080c] dark:text-white"
>
<Relief
ref={wallRef}
words={TOPICS}
raise={raise}
origin={origin}
inks={INKS}
tilt={-5}
label="What customers are writing in about"
className="bg-white dark:bg-[#07080c]"
wordClassName="text-zinc-300 dark:text-zinc-700"
>
<header data-relief-quiet className="mx-auto flex h-16 max-w-6xl items-center justify-between gap-6 px-6">
<a href={BRAND.href} className={`flex items-center gap-2 rounded-sm text-[15px] font-semibold tracking-tight ${ring}`}>
<svg viewBox="0 0 20 20" aria-hidden className="size-5">
<path
d="M10 18V9m0 0C10 5 7 2.5 3 2.5 3 6.5 5.5 9 10 9Zm0 0c0-3.5 2.5-6 6.5-6 0 4-2.5 6-6.5 6Z"
fill="none"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="stroke-[var(--accent)] dark:stroke-[var(--accent-dark)]"
/>
</svg>
{BRAND.name}
</a>
<nav aria-label="Main" className="hidden items-center gap-7 text-sm font-normal text-zinc-600 md:flex dark:text-zinc-400">
{NAV_LINKS.map((link) => (
<a key={link.label} href={link.href} className={`rounded-sm transition-colors duration-150 hover:text-zinc-950 dark:hover:text-white ${ring}`}>
{link.label}
</a>
))}
</nav>
<div className="flex items-center gap-1">
<a
href={SIGN_IN.href}
className={`hidden rounded-full px-3 py-2 text-sm font-medium text-zinc-600 transition-colors duration-150 hover:text-zinc-950 sm:block dark:text-zinc-400 dark:hover:text-white ${ring}`}
>
{SIGN_IN.label}
</a>
<a
href={NAV_CTA.href}
className={`rounded-full bg-zinc-950 px-4 py-2 text-sm font-medium text-white transition-colors duration-150 hover:bg-zinc-800 dark:bg-white dark:text-zinc-950 dark:hover:bg-zinc-200 ${ring}`}
>
{NAV_CTA.label}
</a>
</div>
</header>
<div className="mx-auto flex max-w-6xl flex-col items-center px-6 pt-20 pb-24 text-center sm:pt-24 sm:pb-28 lg:pt-28 lg:pb-32">
<div data-relief-quiet className="flex max-w-3xl flex-col items-center">
<h1 className="text-[2.5rem] leading-[1.04] font-semibold tracking-[-0.04em] text-balance sm:text-6xl lg:text-[4.25rem]">
{HEADLINE[0]}
<br />
<span className="text-zinc-500 dark:text-zinc-400">{HEADLINE[1]}</span>
</h1>
<p className="mt-6 max-w-xl text-base leading-relaxed font-normal text-pretty text-zinc-600 sm:text-lg dark:text-zinc-400">
{SUBLINE}
</p>
<div className="mt-9 flex flex-wrap items-center justify-center gap-3">
<a
href={PRIMARY.href}
className={`rounded-full bg-zinc-950 px-5 py-3 text-sm font-medium text-white transition-colors duration-150 hover:bg-zinc-800 dark:bg-white dark:text-zinc-950 dark:hover:bg-zinc-200 ${ring}`}
>
{PRIMARY.label}
</a>
<a
href={SECONDARY.href}
className={`rounded-full border border-zinc-200 bg-white px-5 py-3 text-sm font-medium text-zinc-900 transition-colors duration-150 hover:border-zinc-300 hover:bg-zinc-50 dark:border-white/15 dark:bg-[#07080c] dark:text-white dark:hover:border-white/25 dark:hover:bg-white/5 ${ring}`}
>
{SECONDARY.label}
</a>
</div>
</div>
<div
ref={readoutRef}
data-relief-quiet
className="mt-14 flex h-11 items-center gap-3 rounded-full border border-zinc-200 bg-white pr-1.5 pl-4 text-sm font-normal shadow-[0_10px_30px_-12px_rgb(0_0_0/0.2)] dark:border-white/10 dark:bg-[#0d0f16]"
>
<span aria-hidden className="relative flex size-2">
<span className="absolute inset-0 rounded-full bg-[var(--accent)] opacity-40 motion-safe:animate-ping dark:bg-[var(--accent-dark)]" />
<span className="relative size-2 rounded-full bg-[var(--accent)] dark:bg-[var(--accent-dark)]" />
</span>
<p aria-live="polite" className="whitespace-nowrap text-zinc-600 dark:text-zinc-400">
{current ? (
<>
Rising now:{" "}
<span className="font-semibold text-[var(--accent)] dark:text-[var(--accent-dark)]">{current.topic}</span>{" "}
<span className="tabular-nums">{current.change}</span> this hour
</>
) : (
"Reading 1,204 tickets an hour"
)}
</p>
<button
type="button"
onClick={() => setPlaying((p) => !p)}
aria-label={playing ? "Pause the live readout" : "Play the live readout"}
className={`grid size-8 place-items-center rounded-full text-zinc-500 transition-colors duration-150 hover:bg-zinc-100 hover:text-zinc-900 dark:hover:bg-white/10 dark:hover:text-white ${ring}`}
>
<svg viewBox="0 0 12 12" aria-hidden className="size-3" fill="currentColor">
{playing ? (
<path d="M3 2h2v8H3zM7 2h2v8H7z" />
) : (
<path d="M3.5 2.2v7.6L10 6z" />
)}
</svg>
</button>
</div>
</div>
</Relief>
</section>
);
}
Installation
The CLI writes components/relief-hero.tsx, the components it's built with (components/ui/relief.tsx) and lib/utils.ts, and installs clsx and tailwind-merge. It needs the @keyframeui registry in components.json; add it once per project.
npx shadcn@latest add @keyframeui/relief-heroThen put it where the section goes. The copy, links and data sit in constants at the top of the file, so making it yours starts there.
app/page.tsx
import { ReliefHero } from "@/components/relief-hero";
export default function Page() {
return <ReliefHero />;
}
Built with
Each of these is a component on its own, with its own examples and props. The block installs them for you.