GlassLens

A magnifier that drifts after the cursor like a drop of water. Press to zoom further. Effects.

Open playground

Small print, made readable

Move over the text. The lens follows with a little lag and magnifies what is underneath.

About

GlassLens is a React component in the Effects category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { GlassLens } from "@ashutoshswamy/smoui" and set children, zoom, zoomPressed among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { GlassLens } from "@ashutoshswamy/smoui";

<GlassLens className="rounded-2xl p-6" zoom={1.7}>
  <h3>Small print, made readable</h3>
</GlassLens>

Props 4

children

Content to magnify.

ReactNode
zoom

Magnification at rest.

numberdefault 1.7
zoomPressed

Magnification while pressed.

numberdefault 2.4
size

Lens diameter in px.

numberdefault 150