Skip to content
← Components

Gradient Mesh

Gradient Mesh adds a distinctive visual surface to your composition.

Open ↗

Make it yours.

Install the editable source and its dependencies into your React + Tailwind project.

Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/gradient-mesh.json

Use it

Scroll horizontally for long lines
"use client";
import { GradientMesh } from "@/components/jez-ui/ui/gradient-mesh";

export default function Example() {
  return (
    <>
      <GradientMesh className="min-h-[360px]">
        <div className="flex min-h-64 flex-col justify-between">
          <h3 className="max-w-md font-display text-5xl font-medium leading-[1.03] tracking-tight md:text-6xl">
            A softer edge.
          </h3>
          <p className="mt-8 text-sm">Colour, with room to breathe.</p>
        </div>
      </GradientMesh>
    </>
  );
}

Props & types

Scroll horizontally for long lines
Omit<
  React.ComponentProps<"div">,
  keyof {
    children?: React.ReactNode;
    className?: string;
  }
> & {
  children?: React.ReactNode;
  className?: string;
}

Source

View 2 source files

registry/ui/gradient-mesh.tsx

Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
export function GradientMesh({
  children,
  className,
  ...rootProps
}: Omit<
  React.ComponentProps<"div">,
  keyof {
    children?: React.ReactNode;
    className?: string;
  }
> & {
  children?: React.ReactNode;
  className?: string;
}) {
  return (
    <div
      {...rootProps}
      className={cn("min-h-60 rounded-xl p-8 text-[#151818]", className)}
      style={{
        background:
          "radial-gradient(at 10% 15%,#d3fb65,transparent 65%),radial-gradient(at 90% 10%,#b0c6ff,transparent 60%),radial-gradient(at 55% 95%,#f6ab81,transparent 65%),#f0f0df",
        ...rootProps.style,
      }}
    >
      {children}
    </div>
  );
}

registry/ui/utils.ts

Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
  return twMerge(clsx(values));
}

Dependencies

clsx@2.1.1 · tailwind-merge@3.5.0

Accessibility & behaviour

Respect reduced-motion preferences. Decorative effects must not carry essential information. WebGL scenes include a static fallback and only render while visible.

Read the accessibility and performance guide →