# Frosted Panes

> A wall of frosted glass tiles over slowly drifting colour: soft, bright light inside each pane, sharp colour in the gaps, and a glint where the pointer is.

Category: Backgrounds · Free · Updated 2026-11-11 · Live demo: https://www.motionkitui.com/components/frosted-panes

## When to use it

SaaS and product heroes, feature sections, pricing backdrops and sign-up pages that want a crisp, modern glass look without heavy effects.

## How it works

Three radial gradients drift slowly behind everything. A second copy of them is blurred, brightened and masked to the panes with a repeating SVG tile, a rounded square inset by half the gap, so inside each pane the colour is soft and bright and in the gaps it stays sharp. Another repeating tile draws a fine lit edge round every pane, and a radial highlight tracks the pointer inside the mask, so the panes nearest it catch a glint. However many panes there are, it's one blur and two masks.

## Installation

```bash
npx shadcn@latest add https://www.motionkitui.com/r/frosted-panes.json
```

Or copy `components/motionkit/frosted-panes.tsx` below. Requires react and Tailwind CSS v4. Free for personal projects; commercial use needs MotionKit Plus (https://www.motionkitui.com/pricing).

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  | Your content, laid over the glass. |
| `colors` | `[string, string, string]` | `teal, periwinkle, orchid` | Colours drifting behind the panes. |
| `background` | `string` | `"#0C1010"` | Colour underneath. |
| `cell` | `number` | `84` | Size of each pane, in px. |
| `gap` | `number` | `8` | Space between panes, in px. |
| `blur` | `number` | `18` | How frosted the panes are, in px of blur. |
| `duration` | `number` | `20` | Seconds for the colours to drift round once. |
| `interactive` | `boolean` | `true` | Panes catch the light where the pointer is. |

## Accessibility

- **Keyboard: Not applicable.** A decorative background.
- **Screen readers: Pass.** Every layer is hidden; only your content is read.
- **Reduced motion: Pass.** With reduced motion on, the colour stops drifting; the glint still follows the pointer, which only moves when you do.
- **Colour contrast: Partial.** Ivory text measures 4.3:1 over a typical pane but only 1.5:1 over the brightest, so give text a dark backing, like the pill in the demo, rather than setting it straight on the glass.

## Source

```tsx
"use client";

import { useRef, type CSSProperties, type PointerEvent, type ReactNode } from "react";

type FrostedPanesProps = {
  children?: ReactNode;
  /** Three colours drifting behind the glass. */
  colors?: [string, string, string];
  background?: string;
  /** Size of each pane, in pixels. */
  cell?: number;
  /** Space between panes, where the colour shows sharp. */
  gap?: number;
  /** How frosted the panes are, in pixels of blur. */
  blur?: number;
  /** Seconds for the colours to drift round once. */
  duration?: number;
  /** Panes catch the light where the pointer is. */
  interactive?: boolean;
  className?: string;
};

/** One pane as a repeating SVG tile: a rounded square inset by half the gap on every side. */
const tile = (cell: number, gap: number, body: string) =>
  `url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='${cell}' height='${cell}'>${body.replaceAll("$i", String(gap / 2)).replaceAll("$s", String(cell - gap))}</svg>`)}")`;

/**
 * A wall of frosted glass tiles over slowly drifting colour. Inside each pane the light is soft and bright; in the
 * gaps it shows sharp, and the panes nearest the pointer catch a glint. Pure CSS: one blurred copy of the colour,
 * masked to the panes, so it costs the same however many there are.
 */
export function FrostedPanes({
  children,
  colors = ["#5FAEB4", "#B9C7FF", "#D6A7CE"],
  background = "#0C1010",
  cell = 84,
  gap = 8,
  blur = 18,
  duration = 20,
  interactive = true,
  className = "",
}: FrostedPanesProps) {
  const ref = useRef<HTMLDivElement>(null);
  const [a, b, c] = colors;
  const radius = Math.round((cell - gap) * 0.16);
  const pane = tile(cell, gap, `<rect x='$i' y='$i' width='$s' height='$s' rx='${radius}' fill='white'/>`);
  const rim = tile(
    cell,
    gap,
    `<defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='white' stop-opacity='.5'/><stop offset='.5' stop-color='white' stop-opacity='.06'/><stop offset='1' stop-color='white' stop-opacity='.22'/></linearGradient></defs><rect x='$i' y='$i' width='$s' height='$s' rx='${radius}' fill='none' stroke='url(#g)' stroke-width='1'/>`,
  );
  const colour = `radial-gradient(38% 50% at 25% 35%, ${a}, transparent 70%), radial-gradient(40% 50% at 75% 40%, ${b}, transparent 70%), radial-gradient(45% 55% at 50% 85%, ${c}, transparent 70%)`;
  const masked: CSSProperties = { maskImage: pane, WebkitMaskImage: pane, maskSize: `${cell}px ${cell}px`, WebkitMaskSize: `${cell}px ${cell}px` };

  function move(event: PointerEvent) {
    if (!interactive || event.pointerType === "touch") return;
    const rect = ref.current!.getBoundingClientRect();
    ref.current!.style.setProperty("--pane-x", `${event.clientX - rect.left}px`);
    ref.current!.style.setProperty("--pane-y", `${event.clientY - rect.top}px`);
    ref.current!.style.setProperty("--pane-glint", "1");
  }

  return (
    <div
      ref={ref}
      data-panes=""
      onPointerMove={move}
      onPointerLeave={() => ref.current?.style.setProperty("--pane-glint", "0")}
      className={`relative isolate overflow-hidden ${className}`}
      style={{ backgroundColor: background, "--pane-x": "50%", "--pane-y": "30%", "--pane-glint": "0" } as CSSProperties}
    >
      <style>{`@keyframes panes-drift{0%,100%{transform:translate(0,0) rotate(0) scale(1)}33%{transform:translate(6%,-4%) rotate(8deg) scale(1.08)}66%{transform:translate(-5%,5%) rotate(-6deg) scale(1.04)}}@media (prefers-reduced-motion:reduce){[data-panes] [data-drift]{animation:none!important}}`}</style>
      {/* the colour, sharp: it shows in the gaps between panes */}
      <div aria-hidden data-drift="" className="absolute -inset-[15%] -z-30" style={{ backgroundImage: colour, opacity: 0.55, animation: `panes-drift ${duration}s ease-in-out infinite` }} />
      {/* the same colour, blurred and brightened, seen only through the panes */}
      <div aria-hidden className="absolute inset-0 -z-20" style={masked}>
        <div data-drift="" className="absolute -inset-[15%]" style={{ backgroundImage: colour, filter: `blur(${blur}px) saturate(1.3) brightness(1.15)`, animation: `panes-drift ${duration}s ease-in-out infinite` }} />
        <div className="absolute inset-0 bg-white/[0.06]" />
        <div
          className="absolute inset-0 transition-opacity duration-500"
          style={{ background: "radial-gradient(220px circle at var(--pane-x) var(--pane-y), rgb(255 255 255 / 0.35), transparent 70%)", opacity: "var(--pane-glint)" }}
        />
      </div>
      {/* a fine lit edge round every pane */}
      <div aria-hidden className="pointer-events-none absolute inset-0 -z-10" style={{ backgroundImage: rim, backgroundSize: `${cell}px ${cell}px` }} />
      {children}
    </div>
  );
}
```
