Interactions
Lens zoomFree

Image Lens

An interactive magnifying lens with smooth spring cursor tracking, customizable zoom levels, blur physics, and optional textual overlay.

Full-page view

Live preview

Interact with the effect here. Drag, hover, and use its controls.

Variation Tweaking

Adjust the options and see the preview update live.

2.2
4
0.15
Overlay label

Installation

Install automatically via CLI or manually integrate dependencies and code.

$npx @istmx/ui add image-lens

Usage

Import the component and configure visual variants, sizes, and operational states.

import { ImageLens } from '@/components/ui/image-lens'
 
<ImageLens
src="/assets/images/cj1.jpg"
alt="CJ San Andreas"
zoom={2.2}
blur={4}
speed={0.15}
text="CJ"
/>

Composition

Compose with icons, form triggers, and layout containers.

<div className="aspect-[4/3] w-full max-w-2xl overflow-hidden rounded-3xl border border-border">
<ImageLens
src="/assets/images/cj1.jpg"
alt="CJ"
zoom={2.2}
blur={4}
text="CJ"
/>
</div>

API Reference

Property matrix, types, defaults, and usage descriptions.

PropTypeDefaultDescription
srcstring''Image URL to display and inspect.
altstring''Descriptive alt text for the image.
zoomnumber2Magnification multiplier inside the lens circle.
blurnumber4Gaussian blur radius applied to peripheral content.
speednumber0.15Spring follow interpolation factor.
textstring''Optional text overlay positioned over the image.

Data Attributes

State-reflecting DOM attributes for custom selector styling.

This component does not expose custom data attributes. Standard HTML data attributes are forwarded to its interactive element.

How It Works

A circular focal lens tracks pointer movement with damped spring physics. The underlying image is magnified proportionally through CSS transforms and background positioning, while surrounding content receives configurable Gaussian blur.

Accessibility

Focusable viewport with descriptive image alt text, keyboard inspection support, and reduced-motion fallback.

Keyboard Navigation
TabFocus the lens viewport.
Arrow keysNudge the lens across the image.

Limitations

•High zoom levels require high-resolution source images to avoid pixelation.

Features

•Tactile spring-damped pointer following.
•Configurable zoom level and peripheral Gaussian blur.
•Text overlay support with custom titles.
•Smooth keyboard inspection navigation.
Credits

Meet the team behind the interaction

Crafted for modern web applications and AI agent workflows.

Aryan

Aryan

@istmX

Building high-performance interfaces, developer tooling, and autonomous agent workflows.

Helped by
Ella

Ella

UI/UX Designer

Crafting beautiful experiences.

Kenji

Kenji

WebGL & Shader Designer

Bringing visuals to life.

Sarah

Sarah

Motion Designer

Animating the details.