motionkit.byHizmedia (opens hizmedia.com in a new tab)
ComponentsTheme StudioPage BuilderPricing

Start building with motion.

206 animated React components, free to browse and customise. Plus unlocks every premium one, with a 14-day free trial.

Browse componentsSee Plus
motionkit.

Animated React components for people who love the details. Built with TypeScript, Tailwind CSS and Motion.

  • Hizmedia on Instagram (opens in a new tab)
  • Hizmedia on LinkedIn (opens in a new tab)
  • Hizmedia on YouTube (opens in a new tab)

Product

  • Components
  • Theme Studio
  • Page Builder
  • MotionKit Plus
  • What's new

Components

  • Backgrounds
  • Text effects
  • Buttons
  • Cards
  • Sections
  • All 206 components

Resources

  • Guides
  • Free tools
  • Free components
  • For shadcn/ui
  • Liquid glass
  • Hero sections

Company

  • About
  • Cookie policy
  • Your account
  • Hizmedia (opens in a new tab)
  • Start a project

motionkit.

ยฉ 2026 Hizmedia (opens hizmedia.com in a new tab)ยท Designed and built in the UK

RSS Back to top
    1. Guides
    2. Performance

    Animated Hero Sections in Next.js That Stay Fast

    Build an animated hero section in Next.js that keeps a good Core Web Vitals score: server-rendered text, a client background, no hidden headlines.

    HHizmediaUpdated 10 November 20267 min read
    On this page
    1. 01Keep the text on the server
    2. 02Never start the headline at opacity 0
    3. 03Start heavy backgrounds late
    4. 04Keep the headline readable
    5. 05Respect reduced motion
    6. 06Measure it

    The hero is where motion does the most good and the most harm. It is the first thing anyone sees, and it usually holds the page's Largest Contentful Paint, the moment Google uses to judge how fast your page loads. This guide shows how to build an animated hero in the Next.js App Router that still loads fast, with the specific mistakes we found and fixed on MotionKit's own homepage.

    01Keep the text on the server#

    Only the parts that move need to be client components. Put the animated background in a "use client" component that takes children, and pass the headline and buttons in from the server page. The text then arrives in the HTML, readable before any JavaScript runs, and the bundle holds only the background's code.

    app/page.tsx
    import { AuroraMesh } from "@/components/motionkit/aurora-mesh";
    
    export default function Page() {
      return (
        <AuroraMesh className="flex min-h-[80svh] items-center justify-center px-6">
          <div className="max-w-2xl text-center">
            <h1 className="text-5xl font-semibold tracking-tight">Ship pages that feel alive</h1>
            <p className="mt-5 text-lg text-white/70">Animated sections you paste in and own.</p>
          </div>
        </AuroraMesh>
      );
    }

    02Never start the headline at opacity 0#

    Fading the headline in from opacity: 0 is the most common way to ruin a hero's score. Browsers don't count fully transparent text as painted, so Largest Contentful Paint waits until the animation finishes: on our homepage that cost a full second. Start from a barely visible value instead. It looks identical, but the text counts as painted from the first frame.

    example.tsx
    <motion.span
      initial={{ opacity: 0.01, y: "0.4em", filter: "blur(10px)" }}
      animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
      transition={{ duration: 0.8, ease: [0.22, 1, 0.36, 1] }}
    >
      Ship pages that feel alive
    </motion.span>

    Keep entrance animations short, under a second in total, and animate transform, opacity and filter only, so nothing moves the layout around the text.

    03Start heavy backgrounds late#

    A WebGL background is the most expensive thing on most landing pages. On a phone or laptop without a GPU, the browser draws WebGL on the CPU, and creating the first context alone can block the page for seconds. That is also how PageSpeed Insights runs its tests, which is why a beautiful shader hero can score in the thirties there.

    • Show a still or CSS-animated fallback in the same colours first, so the hero never looks empty.
    • Start the shader on the visitor's first pointer move, touch, scroll or key press. On desktop that is almost immediate.
    • Where WebGPU reports only a software adapter, don't start it at all.
    • Pause it when it scrolls out of view, and render below full resolution: soft shapes look the same at a fraction of the pixels.

    Lighter backgrounds built from CSS gradients, SVG or a 2D canvas, like Aurora Mesh, Grain Gradient or Perspective Grid, can start straight away.

    04Keep the headline readable#

    Moving colour behind text is a contrast problem that changes every frame. Lay a soft radial darkening behind the headline so the brightest moment of the background still leaves 4.5:1 for body text and 3:1 for large headings. Check it against the brightest frame, not a quiet one.

    example.tsx
    <div aria-hidden className="pointer-events-none absolute inset-0 -z-[5]
      bg-[radial-gradient(ellipse_55%_45%_at_50%_48%,rgb(7_8_13/0.72),transparent)]" />

    05Respect reduced motion#

    Read useReducedMotion() from Motion and skip entrance animations entirely when it is on: set initial to false so the text renders in its final state. Backgrounds should show a single still frame. Anything that keeps looping for more than five seconds beside your content also needs a way to pause it.

    06Measure it#

    Test with Lighthouse in mobile mode and with PageSpeed Insights after you deploy. Look at Largest Contentful Paint and its breakdown: if most of the time is element render delay, something is hiding or delaying the text. If Total Blocking Time is high and the hero uses WebGL, the background is starting too early.

    Put it into practice

    Components from this guide

    • Launch HeroPlusA complete landing-page hero: a pointer-lit grid, a headline that rises word by word and a product window that tilts flat as you scroll.
    • Aurora MeshPlusFields of teal, sage and clay light drift and blend under swaying aurora ribbons.
    • Glass RibbonsPlusRibbons of iridescent glass drifting through the dark, twisting to bright edges side-on and blooming with colour face-on, like light on a soap film.
    • Kinetic TextHeadlines that rise letter by letter, slide up line by line, blur into focus or light up as you scroll.
    • Infinite Perspective GridPlusA true 3D floor of glowing lines that recedes forever to a lit horizon, with an optional ceiling for a tunnel.
    See all 38 hero sections components
    PreviousHow to Make a Liquid Glass Effect in ReactNext Page Transitions in the Next.js App Router with View Transitions

    On this page

    1. Keep the text on the server
    2. Never start the headline at opacity 0
    3. Start heavy backgrounds late
    4. Keep the headline readable
    5. Respect reduced motion
    6. Measure it

    Found this useful? Send it to someone building with motion.

    Keep reading

    All guides
    • 16ms

      Performanceยท6 min read

      Animated Backgrounds in React Without Hurting Performance

      Build animated React backgrounds that stay smooth: choosing CSS, SVG or canvas, pausing off screen, sharp retina drawing and reduced motion.

      Read guide
    • Fundamentalsยท7 min read

      Scroll Animations in React: whileInView, useScroll and IntersectionObserver

      Three ways to animate on scroll in React: reveal with whileInView, follow scroll position with useScroll, or use IntersectionObserver directly.

      Read guide
    • Effectsยท7 min read

      WebGL Shader Backgrounds in React, Without three.js

      Render an animated shader background in React with plain WebGL: one triangle, a fragment shader, time and pointer uniforms, and the performance details.

      Read guide