Letters cut from iridescent glass: a soap-film spectrum flows through them and, as the cursor nears, they split into red and blue fringes like light through a prism.
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.
Customize
Usage
import { EtchedGlass } from "@/components/motionkit/etched-glass";
<EtchedGlass
as="h1"
className="py-16 text-7xl font-bold tracking-tight"
>
Made of light
</EtchedGlass>Motion
The exact curves this component runs, plotted with Motion's own maths.
Colour drifts
Runs on its own
Hero statements, event and launch titles, section dividers, and brand words that should feel crafted and physical.
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.
Works in the App Router as is. Requires Tailwind CSS v4.
One command adds the file and installs its dependencies. Needs a components.json (run npx shadcn@latest init once if you don't have one).
npx shadcn@latest add https://www.motionkitui.com/r/etched-glass.jsonnpm install motionSave as components/motionkit/etched-glass.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>
);
}
| 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. |
How we audit: the WCAG 2.2 animation checklist and respecting reduced motion in React.
Yes. The file starts with "use client", so you can import it straight into a Server Component page or layout. It works in Vite as is, and in Astro as a React island.
Nothing beyond React and Tailwind CSS v4. There is no MotionKit package and no Tailwind config to add.
Yes. Run npx shadcn@latest add https://www.motionkitui.com/r/etched-glass.json in any project with a components.json. It saves the file to components/motionkit and installs its dependencies.
With reduced motion on, the colour behind stays still.
Letters cut from iridescent glass: a soap-film spectrum flows through them and, as the cursor nears, they split into red and blue fringes like light through a prism.
Lettering made of glass: see-through letters with a bright top edge, a fine rim and a soft glow, and a highlight that glides across with the pointer.
A round glass lens that follows the cursor across a headline, magnifying the letters beneath it with a refracted rim.
Made of light