MenuClose

Mesh Gradient — React Animated Background

Voronoi-cell color fields flowing through a curated palette — the classic mesh-gradient look, live on the GPU.

View source
PreviewWEBGPU
Starting live preview

Usage

import { MeshGradient, MESH_GRADIENT_PRESETS } from "@/components/MeshGradient";

export function MeshHero() {
  return (
    <section style={{ position: "relative", minHeight: "100dvh" }}>
      <MeshGradient {...MESH_GRADIENT_PRESETS.aurora}
        {...{
          interactive: true,
          speed: 0.6,
          scale: 3.2,
          softness: 0.09,
          from: "#0b1120",
          to: "#155e75",
          accent: "#7c3aed",
          deep: "#f472b6"
        }}
      />
      <div style={{ position: "relative", zIndex: 1, padding: "8rem 2rem" }}>
        <h1>Color fields, computed live</h1>
      </div>
    </section>
  );
}
Implementation notes & API

Purpose: animated mesh-gradient background for product heroes and pricing walls. Mount: full-bleed layer behind content. Props: from/to/accent/deep palette, speed, scale (cell size, lower = larger), softness (edge crispness). Pointer: the color field drifts with the cursor; interactive={false} pins it. Guardrails: four-color palette — keep at least one dark tone for text contrast; WebGPU required with fallback prop.

PropertyTypeNotes / default
interactivebooleanfalse in the library; enabled in this preview
fallbackReactNodeShown when the renderer is unavailable
className / stylestring / CSSPropertiesApplied to the outer container
View source on GitHubFree for commercial projects · MIT