A sentence or two that makes the headline concrete. Who it is for and what changes for them.
import type { ReactNode } from "react";
const action = "inline-flex h-(--tui-hero-button-height) items-center justify-center gap-2 rounded-(--tui-hero-button-radius) px-(--tui-hero-button-padding-x) text-(length:--tui-hero-button-size) font-semibold no-underline transition-[filter,background-color,scale] duration-(--tui-duration) active:scale-[0.98]";
// A button with a little depth: a highlight along the top edge, a shade along the bottom, and a soft cast in its own colour.
const raised =
"bg-(--tui-hero-accent) text-(--tui-hero-accent-fg) [background-image:linear-gradient(to_bottom,rgb(255_255_255_/_0.18),rgb(255_255_255_/_0)_55%,rgb(0_0_0_/_0.14))] [box-shadow:inset_0_1px_0_rgb(255_255_255_/_0.24),inset_0_-1px_0_rgb(0_0_0_/_0.2),0_1px_2px_rgb(0_0_0_/_0.2),0_10px_20px_-10px_var(--tui-hero-accent)] hover:brightness-110";
export interface HeroProps {
/** A short announcement in a capsule over the headline, and a word to mark it with. */
eyebrow?: ReactNode;
tag?: string;
title: string;
/** A part of the title to draw in the accent gradient. It has to appear in the title as written. */
highlight?: string;
description?: ReactNode;
primary?: { label: string; href: string };
secondary?: { label: string; href: string };
/** A line of proof under the buttons: initials of a few people, and what to say beside them. */
proof?: { people: string[]; text: ReactNode };
className?: string;
}
/**
* The top of a page. A faint grid falls away behind it and a soft light sits
* under the headline, so the words have somewhere to stand without a picture.
*/
export function Hero({ eyebrow, tag, title, highlight, description, primary, secondary, proof, className }: HeroProps) {
const at = highlight ? title.indexOf(highlight) : -1;
return (
<section data-slot="hero" className={["relative isolate flex w-full flex-col items-center gap-(--tui-hero-gap) overflow-hidden bg-(--tui-hero-bg) px-6 py-(--tui-hero-padding-y) text-center font-(family-name:--tui-font) text-(--tui-hero-fg)", className].filter(Boolean).join(" ")}>
<div
aria-hidden
className="pointer-events-none absolute inset-0 -z-10 [background-image:linear-gradient(var(--tui-hero-grid)_1px,transparent_1px),linear-gradient(90deg,var(--tui-hero-grid)_1px,transparent_1px)] [background-size:48px_48px] [mask-image:radial-gradient(ellipse_62%_58%_at_50%_28%,black,transparent)]"
/>
<div aria-hidden className="pointer-events-none absolute top-[8%] left-1/2 -z-10 h-72 w-[42rem] max-w-full -translate-x-1/2 rounded-full bg-(--tui-hero-glow) blur-[90px]" />
{eyebrow && (
<span data-slot="hero-eyebrow" className="inline-flex h-8 items-center gap-2.5 rounded-full bg-(--tui-hero-eyebrow-bg) pr-3.5 pl-1 text-[13px] font-medium text-(--tui-hero-eyebrow-fg) [box-shadow:inset_0_0_0_1px_var(--tui-hero-grid),0_1px_2px_rgb(0_0_0_/_0.05)]">
{tag && <span className={`inline-flex h-6 items-center rounded-full px-2.5 text-[11px] font-semibold tracking-[0.04em] uppercase ${raised}`}>{tag}</span>}
{eyebrow}
<svg aria-hidden viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" className="size-3.5 opacity-60">
<path d="M6 3.500L10.500 8 6 12.500" />
</svg>
</span>
)}
<h1 className="m-0 max-w-(--tui-hero-width) text-(length:--tui-hero-title-size) leading-[1.03] font-(--tui-hero-title-weight) tracking-[-0.035em] text-balance">
{at < 0 || !highlight ? (
title
) : (
<>
{title.slice(0, at)}
<span data-slot="hero-highlight" className="bg-clip-text text-transparent [background-image:linear-gradient(100deg,var(--tui-hero-accent),var(--tui-hero-highlight-to))]">
{highlight}
</span>
{title.slice(at + highlight.length)}
</>
)}
</h1>
{description && <p className="m-0 max-w-[calc(var(--tui-hero-width)_*_0.7)] text-(length:--tui-hero-text-size) leading-relaxed text-pretty text-(--tui-hero-muted)">{description}</p>}
{(primary || secondary) && (
<div className="mt-2 flex flex-wrap items-center justify-center gap-3">
{primary && (
<a href={primary.href} data-slot="hero-primary" className={`${action} ${raised}`}>
{primary.label}
<svg aria-hidden viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" className="size-4">
<path d="M3.500 8h9M8.500 4l4 4-4 4" />
</svg>
</a>
)}
{secondary && (
<a href={secondary.href} data-slot="hero-secondary" className={`${action} bg-(--tui-hero-bg) text-(--tui-hero-fg) [box-shadow:inset_0_0_0_1px_var(--tui-hero-grid),0_1px_2px_rgb(0_0_0_/_0.06)] hover:bg-(--tui-hero-eyebrow-bg)`}>
{secondary.label}
</a>
)}
</div>
)}
{proof && (
<div data-slot="hero-proof" className="mt-3 flex items-center gap-3 text-[14px] text-(--tui-hero-muted)">
<span className="flex">
{proof.people.slice(0, 5).map((initials, i) => (
<span key={i} aria-hidden className="-ml-2 flex size-8 items-center justify-center rounded-full bg-(--tui-hero-eyebrow-bg) text-[11px] font-semibold text-(--tui-hero-fg) first:ml-0 [box-shadow:0_0_0_2px_var(--tui-hero-bg)]">
{initials}
</span>
))}
</span>
<span>{proof.text}</span>
</div>
)}
</section>
);
}:root {
color-scheme: light;
--tui-bg: #ffffff;
--tui-fg: #0a0a0a;
--tui-muted: #f5f5f5;
--tui-muted-fg: #737373;
--tui-border: #e5e5e5;
--tui-primary: #171717;
--tui-primary-fg: #fafafa;
--tui-ring: #a3a3a3;
--tui-success: #16a34a;
--tui-warning: #d97706;
--tui-danger: #dc2626;
--tui-radius: 8px;
--tui-border-width: 1px;
--tui-space: 4px;
--tui-shadow: none;
--tui-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--tui-text: 14px;
--tui-duration: 150ms;
/* Hero */
--tui-hero-padding-y: calc(var(--tui-space) * 28);
--tui-hero-gap: calc(var(--tui-space) * 6);
--tui-hero-width: 780px;
--tui-hero-title-size: 64px;
--tui-hero-title-weight: 600;
--tui-hero-text-size: 19px;
--tui-hero-button-height: calc(var(--tui-space) * 12);
--tui-hero-button-padding-x: calc(var(--tui-space) * 6);
--tui-hero-button-radius: calc(var(--tui-radius) * 1.5);
--tui-hero-button-size: 15px;
--tui-hero-bg: var(--tui-bg);
--tui-hero-fg: var(--tui-fg);
--tui-hero-muted: var(--tui-muted-fg);
--tui-hero-accent: var(--tui-primary);
--tui-hero-accent-fg: var(--tui-primary-fg);
--tui-hero-eyebrow-bg: var(--tui-muted);
--tui-hero-eyebrow-fg: var(--tui-fg);
--tui-hero-highlight-to: color-mix(in oklab, var(--tui-primary) 42%, var(--tui-bg));
--tui-hero-grid: color-mix(in srgb, var(--tui-fg) 8%, transparent);
--tui-hero-glow: color-mix(in srgb, var(--tui-primary) 14%, transparent);
}
.dark,
[data-theme="dark"] {
color-scheme: dark;
--tui-bg: #0a0a0a;
--tui-fg: #fafafa;
--tui-muted: #1c1c1c;
--tui-muted-fg: #a3a3a3;
--tui-border: #2a2a2a;
--tui-primary: #fafafa;
--tui-primary-fg: #171717;
--tui-ring: #737373;
--tui-success: #22c55e;
--tui-warning: #f59e0b;
--tui-danger: #ef4444;
}Needs Tailwind CSS v4. Import the stylesheet once, after Tailwind.