Skip to content
VenusUI
Get started

Magnifier Loupe

A magnifying glass that follows the pointer over a photo and enlarges what's under it.

Preview

Installation

npx shadcn@latest add @venusui/magnifier-loupe

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/magnifier-loupe.tsx

Usage

The code behind the preview above.

magnifier-loupe-demo.tsx

import { MagnifierLoupe } from "@/components/ui/magnifier-loupe"

// Photos: Unsplash (free under the Unsplash License).
const photo = (id: string, w: number, h: number) => `https://images.unsplash.com/photo-${id}?w=${w}&h=${h}&fit=crop&auto=format&q=80`

export default function MagnifierLoupeDemo() {
  return <MagnifierLoupe src={photo("1523906834658-6e24ef2386f9", 1600, 1200)} alt="The Rialto Bridge over the Grand Canal in Venice" caption="Look closer: boats, windows and shutters." />
}

API reference

PropTypeDefaultDescription
src, altstring—The photo.
zoomnumber2.5How much the lens enlarges.
lensnumber168Lens diameter in pixels.
captionstring—Shown under the photo.

All <figure> props.

Requirements

  • React 19 and Tailwind CSS v4.

Customization

  • Use a large, detailed photo; the lens shows it at zoom times its displayed size.

Accessibility

  • The photo is focusable: arrow keys move the lens (Shift for bigger steps) and Escape puts it down.

Troubleshooting

Something looks different from the preview.
Components use your project’s theme tokens, so surrounding colours and radius follow your styles.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

A card that tilts in 3D toward the pointer with spring physics.

Loading preview

A flight boarding pass with a perforated stub and code that flips to the fare and baggage details.

Loading preview

Stacked cards with the next ones peeking out; Next sends the top card to the back.