Glass Refraction Panel
A card of liquid glass: it bends its backdrop at the rim, with a graduated edge and a light that follows the pointer.
Canvas 2D0 deps1 file · 12 KB TSXreduced-motion aware
Props
"use client";
import { useEffect, useId, useRef } from "react";
import type { CSSProperties, ReactNode } from "react";
/**
* GlassRefractionPanel — a card of liquid glass: it bends what is behind it
* at the rim instead of only blurring it.
*
* Four things make it glass rather than frost:
* 1. REFRACTION. In Chromium the panel measures itself and generates a
* displacement map for its exact size, run inside backdrop-filter, so the
* backdrop visibly curves at the edge like light through a thick pane. The
* bezel scales with the panel (a big panel is a thicker pane), and the
* offset is capped at 0.4 of the bezel so text behind never melts into
* mirrored blobs. Safari and Firefox cannot run SVG filters in
* backdrop-filter yet; they get the rest, which still reads as glass.
* 2. SATURATION. Blur alone is fog. The backdrop is blurred, saturated and
// ---------------------------------------------------------------
// Full source available with a viberdy Pro subscription.
// https://viberdy.dev/pricing
// ---------------------------------------------------------------
}Details
About this component
Most glass cards are a blur and a white border, and they read as frosted plastic. This one is built the way Apple's 2025 material behaves. In Chromium the panel measures itself and generates a displacement map for its exact size, run inside backdrop-filter, so whatever passes behind visibly curves at the edge; the bezel grows with the panel, and the offset is capped at 0.4 of it so text behind bends instead of melting into mirrored blobs. The backdrop is blurred, saturated and brightened together, because blur alone is fog. The rim is graduated, bright along the top-left, faint through the sides and returning weakly at the bottom-right, and the stretch nearest the pointer lights up with a soft specular underneath, easing after it. Choose regular, which dims for legibility, or clear, which keeps a photograph behind it sharp. Safari and Firefox get everything except the bend.
Curator’s note
Rebuilt on 26 Sep 2026 for the Glassmorphism kit: the 2020 frosted version (blur, a uniform border, 16px corners) became liquid glass, with a lens sized to the panel, the kit's graduated rim and 28px corners.


