Zoom lens
A magnifier that follows the pointer, a finger or the arrow keys over an image to show detail.
Arrow keys move the magnifier. Escape hides it.When to use
- Product photos, scans, receipts and signatures.
- Images whose detail matters but the layout is small.
When not to use
- Photos people browse; open a full-screen viewer instead.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/zoom-lens
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
ZoomLens
7 props
PropTypeDefaultDescription
src *string—
alt *string—
width *number—
height *number—
zoomnumber2.5How many times larger the lens shows.
lensSizenumber140
classNamestring—
Keyboard
- Escape
- Closes or cancels, then returns focus to where it came from.
- →
- Moves to the next item or value.
- ←
- Moves to the previous item or value.
- ↓
- Moves to the next item or value.
- ↑
- Moves to the previous item or value.
Accessibility
It exposes img semantics, with aria-label, aria-describedby and aria-hidden kept in step with state.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/zoom-lens.mdThe index of every part is at /llms.txt.
More in Media
RevealUncovers an image or a section as it scrolls into view, or when told to: a wipe from any edge, an iris from the middle, or blinds that open in stripes. Every effect cuts the content itself, and the content settles from a touch larger behind the edge.Moon phaseThe moon for a date, or for a phase you give it. The lit part is a half disc closed by the terminator; when the date changes, the terminator sweeps to the new phase by the shortest way round.Tilt cardA card that tilts toward the pointer with a soft highlight.