GooseUI

Components

Mesh Gradient

New

Blurred color blobs that drift slowly under a layer of SVG grain. The motion is pure CSS, so it works as a server component and costs no JavaScript. Colors default to the theme primary colour and its neighbours on the hue wheel, so they always go together.

Preview

Quiet motion

A soft backdrop for hero sections and cards

Installation

npx shadcn@latest add @gooseui/mesh-gradient
pnpm dlx shadcn@latest add @gooseui/mesh-gradient
yarn dlx shadcn@latest add @gooseui/mesh-gradient
bunx --bun shadcn@latest add @gooseui/mesh-gradient

Usage

The gradient fills the nearest positioned parent. Give the parent a background color, the blobs are blended over it.

import { MeshGradient } from "@/components/ui/mesh-gradient"

export default function Hero() {
  return (
    <section className="relative h-96 overflow-hidden bg-background">
      <MeshGradient />
      <h1 className="relative">Your headline</h1>
    </section>
  )
}

Examples

Custom colors

Pass any number of colors. They cycle through five blob slots.

<MeshGradient
  colors={["#f97316", "#fb7185", "#fbbf24"]}
/>

Less blur, more grain

A smaller blur keeps the shapes visible, a stronger grain adds texture.

<MeshGradient blur={30} grain={0.35} />

Faster and lighter

Speed scales every blob duration. Lower blobOpacity for a subtle tint.

<MeshGradient speed={3} blobOpacity={0.35} grain={0} />

Props

PropTypeDefaultDescription
colorsstring[]var(--primary) ± hueBlob colors, any CSS color or var()
speednumber1Animation speed multiplier, 0 pauses it
blurnumber80Blur radius of the blobs in pixels
blobOpacitynumber0.7Opacity of the blobs from 0 to 1
grainnumber0.15Opacity of the grain layer, 0 disables it
classNamestring-Additional CSS classes for the wrapper

Features

  • No JavaScript: keyframes live in a deduplicated style tag
  • Grain without images: feTurbulence noise in an inline data URI
  • Theme aware: default colors are CSS variables, so they follow the theme
  • Reduced motion: with prefers-reduced-motion the blobs stand still