Skip to content

Mesh Background

Living mesh gradient: four large SVG blobs (DA primary, accent + two hues) drifting slowly, merged by an SVG goo filter for a liquid feel, heavily blurred and grain-dithered. Wraps any content.

glass/effect/mesh-background
Open ↗

Source

"use client";

import { useId, type ReactNode } from "react";
import { motion, useReducedMotion } from "motion/react";
import { cn } from "@/lib/utils";

export interface MeshBackgroundProps {
  children?: ReactNode;
  /** Seconds for one full drift cycle of the blobs. */
  duration?: number;
  /** Blob fill colors (CSS colors or var()). Defaults to the DA primary/accent + two decorative hues. */
  colors?: string[];
  /** Merge blobs together with an SVG "goo" filter for a liquid look. */
  liquid?: boolean;
  className?: string;
}

const PATHS = [
  { cx: 22, cy: 30, r: 26, x: [0, 12, -6, 0], y: [0, 8, 14, 0] },
  { cx: 74, cy: 24, r: 22, x: [0, -14, 6, 0], y: [0, 12, -4, 0] },
  { cx: 58, cy: 74, r: 28, x: [0, 8, -12, 0], y: [0, -10, 6, 0] },
  { cx: 18, cy: 82, r: 18, x: [0, 10, 4, 0], y: [0, -8, -14, 0] },
];

/**
 * Living mesh gradient: four large blobs drifting slowly in an SVG, optionally
 * merged by a goo filter, then heavily blurred. Sits behind any content.
 */
export function MeshBackground({
  children,
  duration = 24,
  colors = ["var(--da-primary)", "var(--da-accent)", "#f472b6", "#818cf8"],
  liquid = true,
  className,
}: MeshBackgroundProps) {
  const reduce = useReducedMotion();
  const filterId = useId().replace(/:/g, "");

  return (
    <div className={cn("relative isolate overflow-hidden", className)}>
      <svg aria-hidden className="absolute inset-0 -z-10 size-full opacity-70 blur-[60px] saturate-150 [mask-image:linear-gradient(to_bottom,black_70%,transparent)]" viewBox="0 0 100 100" preserveAspectRatio="none">
        {liquid && (
          <defs>
            <filter id={filterId}>
              <feGaussianBlur in="SourceGraphic" stdDeviation="4" result="blur" />
              <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 22 -9" />
            </filter>
          </defs>
        )}
        <g filter={liquid ? `url(#${filterId})` : undefined}>
          {PATHS.map((p, i) => (
            <motion.circle
              key={i}
              cx={p.cx}
              cy={p.cy}
              r={p.r}
              style={{ fill: colors[i % colors.length] }}
              animate={reduce ? undefined : { x: p.x, y: p.y }}
              transition={reduce ? undefined : { duration, repeat: Infinity, ease: "easeInOut", delay: i * 1.2 }}
            />
          ))}
        </g>
      </svg>
      {/* Subtle grain keeps large gradients from banding */}
      <div
        aria-hidden
        className="pointer-events-none absolute inset-0 -z-10 opacity-[0.07] mix-blend-overlay"
        style={{
          backgroundImage:
            "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>\")",
        }}
      />
      {children}
    </div>
  );
}

export default MeshBackground;

modules/glass/effect/mesh-background/index.tsx

Props

PropTypeDefaultDescription
childrenReactNode—Foreground content.
durationnumber24Seconds per drift cycle.
colorsstring[][var(--da-primary), var(--da-accent), #f472b6, #818cf8]Blob fills (any CSS color).
liquidbooleantrueApply the goo filter.
classNamestring—Classes on the wrapper (height/padding).

Other background variants in Glass

Background in other art directions

Animated

Dots Background

Halftone dot field in the DA ink color that pans slowly on a diagonal, radially masked so dots fade toward the edges. Pure CSS, configurable gap, dot size and speed.

BrutalistBackground
Animated

Grid Background

Section background: a ruled grid drawn with the DA stroke color that drifts diagonally, solid color blocks that blink in hard steps, and an optional SVG grain layer. Wraps any content.

BrutalistBackground
Animated

Shapes Background

Scattered geometric SVG shapes (squares, circles, triangle, plus) in DA colors with ink outlines and hard shadows, bobbing and tilting in stepped (6-frame) motion behind content.

BrutalistBackground
Animated

Stripes Background

Diagonal hazard stripes (DA color + ink) marching sideways, either as a full background or as two ruled 'hazard tape' bands at top and bottom. Pure CSS, seamless loop.

BrutalistBackground
Animated

Aurora Background

Hero background with three heavily blurred color fields (indigo primary + cyan + violet) drifting slowly over a radially-masked hairline grid, fading into the page at the bottom.

MinimalBackground
Animated

Beams Background

Vertical hairline columns fading at top and bottom, with short primary-colored beams of light falling down some of them at staggered speeds. Pure CSS.

MinimalBackground
Animated

Dot Wave Background

Dot matrix, radially masked, across which a diagonal wave of slightly larger primary-colored dots ripples continuously like a heartbeat. CSS keyframes only.

MinimalBackground
Animated

Grid Glow Background

Hairline grid whose lines light up in the primary color inside a soft radial spotlight that follows the mouse (CSS variables updated on pointer move, no re-render), vignetted to the page color.

MinimalBackground
Animated

Crosshair Background

Measuring crosshair: full-width and full-height hairlines follow the pointer with live mono X/Y coordinates next to the intersection — a design-tool feel for hero areas. Mouse only; hidden otherwise.

Mono CleanBackground
Animated

Guides Background

Layout-grid backdrop: hairline column guides (like a design tool’s grid overlay) that draw in from top to bottom one after another, with tiny mono column numbers along the top. Pure CSS.

Mono CleanBackground
Animated

Halftone Background

Print-inspired halftone: a regular ink dot screen fading out across the section via a linear mask, like a newspaper gradient; static, pure CSS.

Mono CleanBackground
Animated

Word Background

A giant outlined word (hairline stroke, no fill) slowly drifting sideways behind content in an endless loop — typographic texture instead of imagery. Pure CSS.

Mono CleanBackground
Animated

Dot Matrix Background

Fine dot matrix in the border color; dots near the pointer light up in primary through a radial mask that follows the cursor (pointer devices only).

Neo CorporateBackground
Animated

Flow Lines Background

Horizontal “money flow” lines (smooth SVG curves in the border color) with small primary pulses travelling along them — evokes payment rails. SVG + CSS, static with reduced motion.

Neo CorporateBackground
Animated

Glow Background

Two large blurred primary/accent glows drifting slowly behind content, plus a thin horizon line — restrained corporate ambience. Pure CSS, static with reduced motion.

Neo CorporateBackground
Animated

Grid Background

Faint hairline grid in the border color, radially masked toward one edge, with a few cells softly pulsing in primary — the classic fintech hero backdrop. Pure CSS.

Neo CorporateBackground
Animated

Blob Background

Three soft organic blobs (sage, clay, sand) slowly morphing their border-radius and drifting behind content — a living, breathing backdrop. Pure CSS.

Organic SoftBackground
Animated

Hills Background

Layered rolling hills along the bottom in three sage tones, each layer drifting sideways at a different pace (gentle parallax), with an optional clay sun rising slowly.

Organic SoftBackground
Animated

Leaves Background

Leaves drifting down and swaying side to side behind content, in sage/clay tints with varied sizes, speeds and delays. Pure CSS; leaves rest in place with reduced motion.

Organic SoftBackground
Animated

Paper Background

Recycled-paper surface: the cream background with a fine SVG turbulence grain and a soft warm vignette — static texture that makes flat sections feel tactile.

Organic SoftBackground
Animated

Confetti Background

Festive background of flat pastel confetti (dots, pills, squares) drifting down slowly with a gentle spin — for success, onboarding-complete and celebration pages.

Soft FlatBackground
Animated

Polka Background

Soft polka-dot pattern (two offset grids) in a pastel tone, drifting diagonally, with an optional clear center so content stays readable. CSS only.

Soft FlatBackground
Animated

Shapes Background

Calm background of big flat pastel shapes (circles, pills, rounded squares) floating slowly up and down at different phases. Pure CSS.

Soft FlatBackground
Animated

Waves Background

Three layered flat pastel waves (lavender, mint, peach) along the bottom of a section, each drifting sideways at its own pace. SVG + CSS.

Soft FlatBackground