# Etched Glass

> A frosted glass panel with your words cut clean through it, so the colour drifting behind shows soft through the frost and sharp through the letters.

Category: Text · Free · Updated 2026-11-11 · Live demo: https://www.motionkitui.com/components/etched-glass

## When to use it

Hero statements, event and launch titles, section dividers, and brand words that should feel crafted and physical.

## How it works

A field of drifting colour fills the panel, and a frosted layer above it blurs and darkens it with backdrop-filter. The words sit on top, filled with the same field through background-clip: text and drifting in step, so through the letters the colour shows sharp and bright, as if cut clean through the frost. Under the colour the letters have a light base, so they read clearly even between pools of colour, and a bright lip below and a dark lip above make them look carved. An invisible copy of the words sizes the panel.

## Installation

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

Or copy `components/motionkit/etched-glass.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` |  | The words cut through the glass. |
| `colors` | `[string, string, string]` | `teal, periwinkle, amber` | Colours drifting behind the panel. |
| `background` | `string` | `"#0C1010"` | Colour underneath. |
| `blur` | `number` | `22` | How frosted the panel is, in px of blur. |
| `duration` | `number` | `14` | Seconds for the colour to drift round once. |
| `as` | `ElementType` | `"p"` | Element for the words, e.g. h1. |

## Accessibility

- **Keyboard: Not applicable.** Text, not a control.
- **Screen readers: Pass.** The words are real text, read once; the copy that sizes the panel is hidden.
- **Reduced motion: Pass.** With reduced motion on, the colour behind stays still.
- **Colour contrast: Partial.** Most of the lettering measures about 7:1 against the frost, but it drops where a pool of colour sits right behind a letter, so keep it to large display sizes.

## Source

```tsx
"use client";

import type { CSSProperties, ElementType, ReactNode } from "react";

type EtchedGlassProps = {
  /** The words cut through the glass. */
  children: ReactNode;
  /** The element for the words, e.g. "h1". */
  as?: ElementType;
  /** Three colours moving behind the glass. */
  colors?: [string, string, string];
  background?: string;
  /** How frosted the panel is, in pixels of blur. */
  blur?: number;
  /** Seconds for the colour to drift round once. */
  duration?: number;
  className?: string;
};

/**
 * A frosted glass panel with words cut clean through it: behind the frost the colour drifts soft and dim, while
 * through the letters it shows sharp and bright, as if etched into the glass. The words stay real, selectable text.
 */
export function EtchedGlass({
  children,
  as: Tag = "p",
  colors = ["#5FAEB4", "#B9C7FF", "#E9B872"],
  background = "#0C1010",
  blur = 22,
  duration = 14,
  className = "",
}: EtchedGlassProps) {
  const [a, b, c] = colors;
  // the same colour field twice, drifting in step: once behind the frost, once inside the letters
  const pools = `radial-gradient(35% 60% at 20% 40%, ${a}, transparent 70%), radial-gradient(35% 60% at 55% 60%, ${b}, transparent 70%), radial-gradient(35% 60% at 85% 35%, ${c}, transparent 70%)`;
  const drift = { backgroundSize: "200% 100%", animation: `etched-drift ${duration}s ease-in-out infinite alternate` };
  const field: CSSProperties = { ...drift, backgroundImage: `${pools}, linear-gradient(${background}, ${background})` };
  // inside the letters the same pools sit on light glass, so the words read clearly even where no colour is passing
  const cut: CSSProperties = { ...drift, backgroundImage: `${pools}, linear-gradient(color-mix(in srgb, ${b} 30%, #F6F1E8), color-mix(in srgb, ${b} 30%, #F6F1E8))` };

  return (
    <div data-etched="" className={`relative isolate grid place-items-center overflow-hidden rounded-3xl ${className}`}>
      <style>{`@keyframes etched-drift{from{background-position:0% 50%}to{background-position:100% 50%}}@media (prefers-reduced-motion:reduce){[data-etched] [data-field]{animation:none!important}}`}</style>
      <div aria-hidden data-field="" className="absolute inset-0 -z-20" style={field} />
      {/* the frost: blurred, lifted and lightly grained */}
      <div
        aria-hidden
        className="absolute inset-0 -z-10 border border-white/[0.12] bg-white/[0.06] shadow-[inset_0_1px_0_rgb(255_255_255/0.18),inset_0_-1px_0_rgb(255_255_255/0.05)]"
        style={{ backdropFilter: `blur(${blur}px) saturate(0.8) brightness(0.55)`, WebkitBackdropFilter: `blur(${blur}px) saturate(0.8) brightness(0.55)`, borderRadius: "inherit" }}
      />
      {/* the words, filled with the sharp colour field, lined up with the one behind */}
      <div
        data-field=""
        className="absolute inset-0 grid place-items-center px-6 text-center"
        // the bright lip below and dark lip above are what make the letters read as cut into the glass
        style={{ ...cut, WebkitBackgroundClip: "text", backgroundClip: "text", color: "transparent", filter: "drop-shadow(0 1px 0 rgb(255 255 255 / 0.3)) drop-shadow(0 -1px 0 rgb(0 0 0 / 0.35))" }}
      >
        <Tag>{children}</Tag>
      </div>
      {/* an invisible copy holds the panel open to the words' size */}
      <div aria-hidden className="invisible px-6 text-center">
        <Tag>{children}</Tag>
      </div>
    </div>
  );
}
```
