Pages
Hero
Hero Section
A centred hero section for React with a word-by-word headline reveal, badge, two calls to action and an avatar proof row.
hero-section.preview
Install
Copies the source into components/blocks/hero-section.tsx and installs what it needs.
$ pnpm dlx shadcn@latest add https://makeui.xyz/r/hero-section.jsonUsage
app/page.tsx
import { HeroSection } from "@/components/blocks/hero-section"
export default function Page() {
return (
<HeroSection
badge="v2 is out"
title="Ship interfaces people remember"
description="Components, sections and motion you own. Copy, paste, done."
primary={{ label: "Get started", href: "/docs" }}
secondary={{ label: "See components", href: "/components" }}
/>
)
}Source
Prefer to copy by hand? It's one file. Requires motion and the shadcn cn helper.
components/blocks/hero-section.tsx
"use client"
import { motion, useReducedMotion } from "motion/react"
import { ArrowRight } from "lucide-react"
import { cn } from "@/lib/utils"
type Action = { label: string; href: string }
type Props = {
badge?: string
title?: string
description?: string
primary?: Action
secondary?: Action
/** Small line next to the avatar stack. Pass an empty string to hide the row. */
proof?: string
className?: string
}
const avatars = ["bg-amber-300", "bg-sky-300", "bg-rose-300", "bg-emerald-300"]
/** Centred hero. The headline reveals word by word once, everything else stays still. */
export function HeroSection({
badge = "v2 is out",
title = "Ship interfaces people remember",
description = "Components, sections and motion you own. Copy it, paste it, make it yours.",
primary = { label: "Get started", href: "#" },
secondary = { label: "See how it works", href: "#" },
proof = "Loved by 2,400+ builders",
className,
}: Props) {
const reduce = useReducedMotion()
const words = title.split(" ")
return (
<div className="@container">
<section
className={cn(
"relative isolate overflow-hidden bg-white px-6 py-24 text-center dark:bg-neutral-950 @2xl:py-32",
className
)}
>
{/* dotted grid, faded out toward the edges */}
<div
aria-hidden
className="absolute inset-0 -z-10 bg-[radial-gradient(circle,rgb(0_0_0/0.12)_1px,transparent_1px)] [background-size:22px_22px] [mask-image:radial-gradient(60%_60%_at_50%_30%,black,transparent)] dark:bg-[radial-gradient(circle,rgb(255_255_255/0.14)_1px,transparent_1px)]"
/>
{badge && (
<a
href={primary.href}
className="inline-flex items-center gap-2 rounded-full border border-neutral-200 bg-white/70 py-1 pl-2 pr-3 text-xs text-neutral-600 backdrop-blur transition-colors hover:text-neutral-900 dark:border-neutral-800 dark:bg-neutral-900/70 dark:text-neutral-400 dark:hover:text-neutral-100"
>
<span className="rounded-full bg-neutral-900 px-2 py-0.5 text-[11px] font-medium text-white dark:bg-white dark:text-neutral-900">
New
</span>
{badge}
</a>
)}
<h1 className="mx-auto mt-8 max-w-3xl text-balance text-5xl font-medium leading-[1.04] tracking-[-0.04em] text-neutral-900 dark:text-neutral-50 @2xl:text-6xl @5xl:text-7xl">
{words.map((word, i) => (
<span key={i} className="inline-block overflow-hidden pb-[0.08em] align-bottom">
<motion.span
className="inline-block"
initial={reduce ? false : { y: "100%", opacity: 0, filter: "blur(8px)" }}
animate={{ y: 0, opacity: 1, filter: "blur(0px)" }}
transition={{ type: "spring", stiffness: 160, damping: 22, delay: 0.08 * i }}
>
{word}
</motion.span>
{i < words.length - 1 && "\u00A0"}
</span>
))}
</h1>
<p className="mx-auto mt-6 max-w-xl text-pretty text-base leading-relaxed text-neutral-600 dark:text-neutral-400 @2xl:text-lg">
{description}
</p>
<div className="mt-9 flex flex-wrap items-center justify-center gap-3">
<a
href={primary.href}
className="group inline-flex h-12 items-center gap-2 rounded-full bg-neutral-900 px-6 text-[15px] font-medium text-white outline-none transition-transform focus-visible:ring-2 focus-visible:ring-neutral-400/60 focus-visible:ring-offset-2 active:scale-[0.98] dark:bg-white dark:text-neutral-900"
>
{primary.label}
<ArrowRight className="size-4 transition-transform group-hover:translate-x-0.5" />
</a>
<a
href={secondary.href}
className="inline-flex h-12 items-center rounded-full bg-neutral-100 px-6 text-[15px] font-medium text-neutral-800 outline-none transition-colors hover:bg-neutral-200 focus-visible:ring-2 focus-visible:ring-neutral-400/60 dark:bg-neutral-800 dark:text-neutral-100 dark:hover:bg-neutral-700"
>
{secondary.label}
</a>
</div>
{proof && (
<div className="mt-12 flex items-center justify-center gap-3 text-sm text-neutral-500 dark:text-neutral-400">
<div className="flex -space-x-2" aria-hidden>
{avatars.map((c) => (
<span key={c} className={cn("size-7 rounded-full ring-2 ring-white dark:ring-neutral-950", c)} />
))}
</div>
{proof}
</div>
)}
</section>
</div>
)
}