Animated React hero sections: examples with code
Most good animated heroes use one of six patterns: a headline that rises in word by word, a soft moving aurora behind it, a spotlight that follows the pointer, an image that grows as you scroll, a product shot that tilts in 3D, or a strip of customer logos sliding past. Each takes 15 to 30 lines of React with Motion or plain CSS. Pick one, maybe two, and keep the headline readable.
The hero is the first screen of a site: the headline, a line under it and a button. It decides whether people scroll or leave, which is why it's where most of the animation budget goes. Done well, the motion points the eye at the headline. Done badly, it's a loading delay with sparkles.
Below are six patterns that work, each with what it does, when to use it and a compact snippet. We wrote every snippet for this post, type-checked it in strict TypeScript, and ran it in headless Chrome with React 19.3.1 and Motion 14.14.0 before putting it here. Where our component library, Neebarp Vault, has a finished hero built on the same idea, we link to it. We make Vault, so take those links in that light.
Motion is the library formerly called Framer Motion: npm install motion, then import from motion/react. In the Next.js App Router, add "use client"; to the top of any file that uses Motion or React hooks.
1. Staggered headline, then the rest
What it does: the headline's words rise in one after another, then the subline and the button follow. When to use it: almost always. It's the quietest pattern here, and it works on top of any of the others.
import { motion } from "motion/react";
const rise = (delay: number) => ({
initial: { opacity: 0, y: 32 },
animate: { opacity: 1, y: 0 },
transition: { delay, duration: 0.6, ease: [0.22, 1, 0.36, 1] as const },
});
export function HeroHeadline() {
const words = "Make the first screen count".split(" ");
return (
<section style={{ textAlign: "center", padding: "20vh 1rem" }}>
<h1 style={{ fontSize: "clamp(2.5rem, 7vw, 5rem)" }}>
{words.map((w, i) => (
<motion.span key={i} style={{ display: "inline-block", marginRight: "0.25em" }} {...rise(i * 0.08)}>
{w}
</motion.span>
))}
</h1>
<motion.p {...rise(0.5)}>One line that says what you do.</motion.p>
<motion.a href="#start" {...rise(0.65)}>Get started</motion.a>
</section>
);
}Keep the whole sequence under about a second. In this one the button arrives at 0.65 seconds and is fully in by about 1.25. Anything slower and people start reading before the words have landed.
2. Aurora or gradient background
What it does: two large blurred blobs of colour drift slowly behind the content, like northern lights. When to use it: an AI or software launch on a dark page, where you want depth without a picture.
import "./aurora.css";
export function AuroraHero() {
return (
<section className="aurora" style={{ minHeight: "80vh", display: "grid", placeItems: "center" }}>
<h1>Your headline here</h1>
</section>
);
}
/* aurora.css */
.aurora { position: relative; overflow: hidden; background: #07070a; color: #fff; }
.aurora::before, .aurora::after {
content: ""; position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
filter: blur(80px); opacity: 0.55; z-index: 0;
animation: drift 18s ease-in-out infinite alternate;
}
.aurora::before { background: #1fd1a5; top: -30vmax; left: -10vmax; }
.aurora::after { background: #f5a524; bottom: -35vmax; right: -15vmax; animation-delay: -9s; }
.aurora > * { position: relative; z-index: 1; }
@keyframes drift { to { transform: translate(15vmax, 10vmax) rotate(40deg); } }
@media (prefers-reduced-motion: reduce) { .aurora::before, .aurora::after { animation: none; } }Check the headline's contrast where a blob passes behind it, not just on the dark parts. Vault's Aurora Prompt Hero puts an aurora behind an AI prompt box with a rotating glow, example prompts that type themselves, and a send button that turns into a spinner and then a check. For an aurora as a background alone, see Aurora Veil.

3. Spotlight that follows the pointer
What it does: a soft circle of warm light sits under the pointer and moves with it across a dark hero. When to use it: a developer tool or anything with a dark, technical look. It rewards people for moving the mouse without hiding anything.
import { useRef, type PointerEvent } from "react";
export function SpotlightHero() {
const ref = useRef<HTMLElement>(null);
const move = (e: PointerEvent<HTMLElement>) => {
const r = e.currentTarget.getBoundingClientRect();
e.currentTarget.style.setProperty("--x", `${e.clientX - r.left}px`);
e.currentTarget.style.setProperty("--y", `${e.clientY - r.top}px`);
};
return (
<section
ref={ref}
onPointerMove={move}
style={{
minHeight: "80vh", display: "grid", placeItems: "center", color: "#fff",
background:
"radial-gradient(600px circle at var(--x, 50%) var(--y, 30%), rgba(255,200,120,0.18), transparent 60%), #0a0a0c",
}}
>
<h1>Light follows the pointer</h1>
</section>
);
}On phones there's no pointer, so the light rests where the var() fallbacks put it (50% across, 30% down). Make sure that resting state looks right too. Vault's Signal Grid Hero takes the idea further: grid cells light up under the cursor and leave a glowing trail.
4. Scroll-linked hero
What it does: the hero pins in place while you scroll; a framed picture grows from 60% to full size and its rounded corners square off, while the headline drifts up. When to use it: a product with one great image or video, a portfolio, a launch page.
import { useRef } from "react";
import { motion, useScroll, useTransform } from "motion/react";
export function ScrollHero() {
const ref = useRef<HTMLDivElement>(null);
const { scrollYProgress } = useScroll({ target: ref, offset: ["start start", "end start"] });
const scale = useTransform(scrollYProgress, [0, 1], [0.6, 1]);
const radius = useTransform(scrollYProgress, [0, 1], [32, 0]);
const titleY = useTransform(scrollYProgress, [0, 1], [0, -120]);
return (
<div ref={ref} style={{ height: "200vh" }}>
<div style={{ position: "sticky", top: 0, height: "100vh", display: "grid", placeItems: "center", overflow: "hidden" }}>
<motion.h1 style={{ y: titleY, position: "absolute", zIndex: 1 }}>Scroll to open</motion.h1>
<motion.img
src="/hero.jpg"
alt=""
style={{ scale, borderRadius: radius, width: "100%", height: "100%", objectFit: "cover" }}
/>
</div>
</div>
);
}When we scrolled the outer box 600 pixels in, the image had grown from scale(0.6) to about scale(0.73), so it tracks the scroll exactly. Replace /hero.jpg with your own picture. Finished versions in Vault: Media Expand Hero, where the title parts to either side as the frame grows, Parallax Depth Hero with layered scenery, and Frame Expand Hero, which draws its scene live so there's no video file to host.
5. A product that tilts in 3D
What it does: a screenshot or product card leans toward the pointer with a springy delay, as if it were a real object on a table. When to use it: a SaaS hero with a dashboard screenshot, or an app with a phone mock-up.
import type { PointerEvent, ReactNode } from "react";
import { motion, useMotionValue, useSpring, useTransform } from "motion/react";
export function TiltCard({ children }: { children: ReactNode }) {
const px = useMotionValue(0.5);
const py = useMotionValue(0.5);
const rotateY = useSpring(useTransform(px, [0, 1], [-14, 14]), { stiffness: 150, damping: 15 });
const rotateX = useSpring(useTransform(py, [0, 1], [10, -10]), { stiffness: 150, damping: 15 });
const move = (e: PointerEvent<HTMLDivElement>) => {
const r = e.currentTarget.getBoundingClientRect();
px.set((e.clientX - r.left) / r.width);
py.set((e.clientY - r.top) / r.height);
};
return (
<div onPointerMove={move} onPointerLeave={() => { px.set(0.5); py.set(0.5); }} style={{ perspective: 1000 }}>
<motion.div style={{ rotateX, rotateY, transformStyle: "preserve-3d" }}>{children}</motion.div>
</div>
);
}With the pointer near the card's top-left corner, our run measured about 14 degrees of turn on one axis and 9 on the other, close to the limits set in the code. If you want a real 3D object rather than a tilting picture, see our guide to 3D components for React without learning Three.js, which has a small React Three Fiber scene. In Vault, Dashboard Tilt Hero tilts a live dashboard whose numbers count up and charts draw themselves, and Globe Hero spins a dotted planet you can drag.
6. Customer logos sliding past
What it does: a row of customer or partner logos scrolls sideways for ever under the hero, fading out at both edges. When to use it: when you have real logos to show. It's social proof that doesn't take any vertical space.
import "./logo-marquee.css";
export function LogoMarquee({ logos }: { logos: { name: string; src: string }[] }) {
return (
<div className="logos">
<ul>
{[...logos, ...logos].map((l, i) => (
<li key={i} aria-hidden={i >= logos.length}>
<img src={l.src} alt={l.name} height={28} />
</li>
))}
</ul>
</div>
);
}
/* logo-marquee.css */
.logos {
overflow: hidden;
mask-image: linear-gradient(to right, transparent, #000 15%, #000 85%, transparent);
}
.logos ul { display: flex; gap: 4rem; width: max-content; padding: 0; margin: 0; list-style: none;
animation: logos 30s linear infinite; }
.logos li { flex: none; opacity: 0.7; }
@keyframes logos { to { transform: translateX(calc(-50% - 2rem)); } }
@media (prefers-reduced-motion: reduce) { .logos ul { animation: none; } }The second copy of the logos is hidden from screen readers so they hear each name once. Vault's 3D Marquee Wall Hero turns this into a tilted wall of image columns that stream in opposite directions, and Testimonial Columns does the same for quotes.
Which pattern fits your page
| Pattern | Good for | Needs | Works on phones |
|---|---|---|---|
| Staggered headline | Every hero | Motion | Yes |
| Aurora background | AI and software launches | CSS | Yes |
| Pointer spotlight | Dark, technical brands | React only | Rests in place |
| Scroll-linked | One strong image or video | Motion | Yes |
| 3D tilt | SaaS dashboards, app mock-ups | Motion | Stays flat |
| Logo marquee | Social proof | CSS | Yes |
Rules that keep an animated hero fast
- The headline must be readable in the first frame or two. If it starts invisible, make the animation short. Search engines and impatient people both read the first paint.
- Animate `transform` and `opacity`. They're cheap for the browser. Animating width, height or top causes the page to re-layout on every frame.
- Honour reduced motion. The CSS snippets above include a
prefers-reduced-motionrule. For Motion, wrap the app in<MotionConfig reducedMotion="user">. - Measure the cost. In our test bundle, Motion's
motioncomponent added about 51 KB gzipped to a bare React page, while the CSS patterns added nothing. If the hero is the only animated part of the page, CSS may be all you need. - One star per hero. An aurora plus a spotlight plus a 3D tilt plus a marquee is four things shouting. Pick one main effect and let the staggered headline support it.
Starting from a finished hero
If you'd rather adapt than build, Vault's Heroes category has 8 complete animated hero sections with 32 variants between them, with copy, buttons and choreography included. Warp Hero, a hyperspace starfield that punches to warp when you hover the button, is free. The others come with the same $9 key as the rest of the 788 components, with lifetime updates (checked on 29 November 2026). There are also scroll heroes in the Scroll category and playable three.js heroes in 3D. They're plain React and TypeScript with no runtime dependencies apart from three.js in the 3D scenes.
Questions
What should an animated hero section include?
A clear headline, one line explaining what you do, and one main button. The animation should lead the eye to those, not compete with them. Add a secondary link or a logo strip if you have room.
Do I need Framer Motion for an animated hero?
No. The aurora and logo marquee above are plain CSS, and the spotlight is plain React. Motion, the new name for Framer Motion, makes staggered entrances, springs and scroll-linked effects much easier.
Do hero animations hurt SEO or page speed?
Only if they delay the content. Keep the headline in the HTML, start it visible or nearly so, animate only transform and opacity, and load heavy pieces like 3D scenes after the first paint.
How do I make a hero animate on scroll in React?
Use Motion's useScroll with the hero as the target, map scrollYProgress to scale, opacity or position with useTransform, and pin the content with position: sticky inside a taller wrapper. Example 4 does exactly this.
NEEBARP