Skip to content
Calm motion: animations on this site only fade, with no movement

Loupe ​

Magnifier over an image on hover or touch

A lens that shows the detail under the pointer: a product photo, a map, a screenshot with small text. For flipping through full-size pictures, use Gallery. For comparing two versions, Compare.

Basic
The Blessing docs home page
move over the picture, touch and drag, or focus it and use the arrow keys
  • The lens is a square centerd on the pointer, showing the spot at zoom times (default 2.5) in a box of size px (default 140). It stays inside the picture, and the picture itself does not move.
  • On touch, press and drag. The lens rides above the finger so the finger does not cover what is being looked at, and it goes away when you lift. Vertical swipes still scroll the page.
  • With the keyboard, focus the picture: the lens appears in the middle, arrow keys move it (Shift for bigger steps) and Esc hides it.
  • The lens reads the same file. Pass zoomSrc with a larger version so the enlarged view is sharp instead of a blown-up copy.
  • The lens is purely visual and hidden from screen readers. alt describes the picture as usual, so put anything the lens reveals that matters (a label, a number) in the text around it as well.

Usage ​

ts
import { BlessLoupe } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
src*string—
alt*string—
zoomSrcstring—a larger version of the same picture for the lens; defaults to `src`
zoomnumber2.5magnification
sizenumber140side of the square lens, in px

Released under the MIT License. Character names and artwork belong to their owners.