Image Lens

A glass loupe that follows the pointer and magnifies the image beneath it: the rim refracts and fringes like real glass, the rest of the frame softly desaturates, and pinch, ctrl+wheel or a click change the zoom. Press and hold on touch to lift the lens above your finger. Optional annotations appear only inside the lens.

Try it: Hover the image to magnify; click or pinch to zoom further. On touch, press and hold.

Installation

Install with the shadcn CLI:

npx shadcn@latest add https://www.framekitui.live/r/image-lens.json

Or, with the @framekit namespace registered: npx shadcn@latest add @framekit/image-lens. You can also copy the source into components/ui/image-lens.tsx (view on GitHub).

Usage

import { ImageLens } from '@/components/ui/image-lens'

Props

Component props
PropTypeDefaultNotes
src / altstring—Image to magnify — a full URL (https://…) or a file in your public/ folder (/images/peak.jpg) — and its description. Shows a shimmer while loading and falls back to the built-in vector scene if the image fails. Without src the original vector dusk scene is drawn.
zoomSrcstring—Optional higher-resolution image used only inside the lens, fetched the first time the lens opens (e.g. the same photo at 2× width).
childrenReactNode—Magnify any content instead of an image (rendered twice; the lens copy is decorative).
zoom / minZoom / maxZoomnumber2.5 / 1.5 / 5Starting magnification and its range. Click cycles three levels; pinch or ctrl+wheel zooms freely.
sizenumber190Lens diameter in px (capped to 60% of the frame width).
shape'circle' | 'rounded''circle'Round loupe or a soft squircle.
appearance'glass' | 'minimal' | 'seamless''glass'glass: rim, colour fringe, refraction and highlight. minimal: a clean crisp edge with only a faint shadow. seamless: no edge at all — the magnified view feathers into the image.
annotations{ x, y, label }[]—Pins (x / y as 0–1 fractions) that only appear inside the lens; also listed for screen readers.
dimbooleantrueDesaturate and dim everything outside the lens.
aspectRatiostring'3 / 2'Frame aspect ratio (CSS value).
captionReactNode—Optional figcaption under the image.
onZoomChange(zoom: number) => void—Fires when the magnification changes.

Dependencies

  • motion
  • lucide-react
  • Dealer Deck Testimonials

    Testimonials dealt like playing cards: the top card of a face-down deck slides across the table on a spring, flips face-up mid-flight and lands slightly askew on the pile. Take one back or gather…

  • Discovery Scene

    An illustrated desk (night in dark mode, daylight in light) with six hidden sparkles. Each find lights its object — lamp, steam, spinning record — reveals a fact, and counts toward “found 6 / 6”.…

  • Particle Mesh Gallery

    An image-colored particle sphere unfolds into a portrait on tap and gathers back on double tap, with original landscape art and a quiet project index.

  • Mini Desktop OS

    A tiny windowed desktop for a portfolio: generated wallpaper, menu bar with a live clock, icon grid, draggable windows with close / minimise / maximise, and a dock. Keyboard-movable; sheets on phones.

  • Project Reveal List

    An editorial project index: rows dim their siblings and nudge on hover while a tilting preview chases the cursor on a spring and unmasks with a clip-path. Touch gets inline thumbnails.

  • Big-Type Footer

    A closing section built around one enormous word whose letters swell and lean toward the cursor, with a ticker, quiet link pills, a live local clock and back-to-top. Light paper / dark ink, never a…

See all 35 Portfolio components