Pro
Image zoom
An image in a page that opens to fill the screen from where it sits: press it and it grows out of its own place with the page dimmed behind. Escape, a press anywhere, scrolling or resizing put it back and return focus to it.
pnpm dlx shadcn@latest add @caliper/image-zoomWhen to use
Use it for
- Screenshots and photos in docs, changelogs and reports that are worth a closer look.
- Single images; a set of images belongs in the image viewer.
Skip it when
- Galleries people page through; use the image viewer.
- Detail inspection at high zoom; use the zoom lens.
Decisions
Why it is built this way, so you know what to keep when you change your copy.
Behaviour
- One transform
- The open image is placed once at its fitted size and transformed from and back to its inline box, so only transform animates.
- Sharper on demand
zoomSrcloads a larger file only when it opens; without it the image never grows past its own pixels.
Installation
pnpm dlx shadcn@latest add @caliper/image-zoom
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.
Usage
Import it from your copy of the source. The example behind the preview comes with the source.
import { ImageZoom } from "@/components/ui/image-zoom"
The worked example comes with Pro
The 27-line example behind the preview opens here, ready to copy.
- 576 Pro parts, blocks and page templates, all with source
- $199 once, with a year of updates. What you have stays yours
- A full refund within 14 days if it is not for you
API reference
ImageZoom
component
Accessibility
It exposes dialog semantics, with aria-label, aria-haspopup and aria-modal kept in step with state.
Motion
It checks prefers-reduced-motion itself and settles immediately instead of travelling. Every state is still reachable.