ValyroUI Русская версия

Glass Lens

Glass lens with real refraction. Pro · Effects › Glass

A Liquid Glass surface with real refraction: the rim bends the backdrop inward like a convex glass edge, with a specular highlight and optional colour fringing and magnification. Refraction uses an SVG displacement map through backdrop-filter: url(#…), which only Chromium renders; Safari and Firefox get frosted glass (blur, saturation, specular rim). The Vercel theme turns the lens into a crisp panel or a clean magnifier with a 1px ring.

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add glass-lens
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { GlassLens } from 'valyro-ui-pro';

Props

PropTypeDefault
strengthnumber24How far, in px, the rim pulls the backdrop inward at the very edge. 0 turns edge refraction off.
radiusnumber | 'full'Corner radius in px, or 'full' for a capsule or circle. Default: the theme's card radius (a circle when movable).
blurnumberFrost: backdrop blur in px; 0 gives clear glass. Default: 6, or 0 for a movable lens.
zoomnumber1Magnification of the backdrop at the centre, like a loupe. 1 = none.
aberrationnumber0.4Colour fringing at the rim, 0–1: red, green and blue bend by slightly different amounts.
movablebooleanfalseLets the user move the lens over its container with a pointer or the arrow keys (Shift = faster). The lens is absolutely positioned, so the container needs position: relative.
positionGlassLensPositionControlled position of a movable lens: fractions of the free travel inside the container.
defaultPositionGlassLensPositionInitial position when uncontrolled.
onPositionChange(position: GlassLensPosition) => voidCalled with the new position when it changes.
labelsPartial<GlassLensLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: Halftone Image Reveal · Next: Morphing Capsule · All Effects