Liquid glass you can hold: a domed lens that magnifies and bends the backdrop with a rainbow rim, squashing like jelly as you drag it and casting focused light into its shadow.
A disc of liquid glass that glides after the cursor, enlarging whatever is beneath it, with a rainbow rim and a highlight rolling across the dome.
Customize
Usage
import { GlassLens } from "@/components/motionkit/glass-lens";
<GlassLens className="rounded-3xl">
<img src="/hero.jpg" alt="Sunset over the hills" className="w-full" />
</GlassLens>Motion
The exact curves this component runs, plotted with Motion's own maths.
Lens follows
Pointer moves
Idle drift
No pointer
Photography and product heroes, art and illustration portfolios, detailed maps or diagrams, and headlines that want a playful, tactile moment.
Your content renders once as normal, then a second, inert copy sits inside a round clipping disc and is scaled up by the zoom. As the lens moves, the copy is shifted by the lens position times the zoom, so the point under the centre of the lens stays exactly in place while everything around it is enlarged. Springs give the glide its weight. The glass is layered on top: inset shadows for thickness, a conic rainbow masked to a thin ring for the rim and a radial highlight that slides the opposite way to the lens, as light does on a dome.
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | What sits under the glass: an image, a headline or a whole card. |
| zoom | number | 1.8 | How much the lens enlarges. |
| size | number | 150 | Lens diameter in pixels. |
| dispersion | number | 0.7 | Strength of the rainbow rim, 0 to 1. |
| idle | boolean | true | Drift slowly over the content while no pointer is on it. |
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.
Only the motion package, beside React and Tailwind CSS v4. There is no MotionKit package and no Tailwind config to add.
Yes, with MotionKit Plus. Add the @motionkit registry and your personal token to components.json (the snippet is on your account page), then run npx shadcn@latest add @motionkit/glass-lens. It saves the file to components/motionkit and installs its dependencies.
Glass Lens is part of MotionKit Plus (£12 / $15 / €14 a month or £96 / $120 / €112 a year). The live preview and playground are free to explore; Plus unlocks its source code, every customisation control and commercial use.
With reduced motion on, the lens doesn't drift by itself and follows the pointer without easing.
Yes. The lens ignores the pointer, so links and buttons beneath it work as normal, and the enlarged copy is inert, so it's never focused or read twice.
Liquid glass you can hold: a domed lens that magnifies and bends the backdrop with a rainbow rim, squashing like jelly as you drag it and casting focused light into its shadow.
Crystal-clear glass cards with lens-like edges, rainbow dispersion, a rim highlight that tracks the pointer and a liquid press.
A card with a soft glow that tracks the pointer across its surface.
The live preview is free to explore. Plus unlocks the source for Glass Lens and every other premium component.
Not ready for Plus? A free account unlocks 4 premium components, Depth Card, Rolling Text, Dot Wave and Confetti Button, with no card needed.
Customize
Usage
import { GlassLens } from "@/components/motionkit/glass-lens";
<GlassLens className="rounded-3xl">
<img src="/hero.jpg" alt="Sunset over the hills" className="w-full" />
</GlassLens>Motion
The exact curves this component runs, plotted with Motion's own maths.
Lens follows
Pointer moves
Idle drift
No pointer