GodUI

Liquid Glass Lens

A circular glass lens that floats over your content and follows the cursor, refracting everything beneath it.

Liquid Glass

Installation

pnpm dlx shadcn@latest add "https://godui.design/r/liquid-glass-lens.json"

LiquidGlassLens is a circular glass disc that floats over its parent's content and tracks the cursor, refracting everything beneath it through a converging SVG displacement map. It only appears while the pointer is over the parent and fades out on leave. It is pointer-events-none, so it never blocks clicks.

True refraction requires backdrop-filter: url() (Chrome and Edge). In browsers without it the lens gracefully falls back to a plain frosted blur.

For a static glass panel that wraps your own content, see Liquid Glass Card.

Usage

The parent must be positioned (relative). Drop the lens in as a sibling of the content you want it to roam over:

tsx
 
import { LiquidGlassLens } from "@/components/godui/liquid-glass-lens";

<div className="relative">
  {/* ...images, text, any page content... */}
  <LiquidGlassLens size={200} />
</div>

Sizing

size is the lens diameter in px. Bump strength for a stronger magnify.

tsx
 
<LiquidGlassLens size={260} strength={110} dispersion={0.25} />

Props

PropTypeDefaultDescription
sizenumber160Diameter of the circular lens in px.
blurnumber2Frost (backdrop blur) in px.
strengthnumber80Refraction displacement scale — how hard the lens bends.
dispersionnumber0.15Chromatic aberration, 01. Splits the R/G/B refraction.
saturationnumber1.6Backdrop saturation multiplier.
tintstringrgba(255,255,255,.08)Glass tint color.
sheennumber0.5Specular highlight intensity, 01.

LiquidGlassLens also forwards every standard <div> attribute (className, style, id, …) to the root element.

On this page

Built with GodUI

Beautifully crafted motion components for modern interfaces.

Star on GitHub