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.
The terrace takes six desks in summer; the quay side is quiet until noon. Power runs along the north wall only.
When to use
- 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.
When not to use
- Galleries people page through; use the image viewer.
- Detail inspection at high zoom; use the zoom lens.
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.
API reference
ImageZoom
7 props
Keyboard
- Escape
- Closes or cancels, then returns focus to where it came from.
- Enter
- Activates the focused control.
- Space
- Activates the focused control.
- Tab
- Moves focus through the part's focusable elements.
Accessibility
It exposes dialog semantics, with aria-label, aria-haspopup and aria-modal kept in step with state.
Motion
- State changes animate with the library's shared durations and curves, so its timing matches every other part.
- Under reduced motion each change lands on its end state without movement; nothing is hidden or skipped.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/image-zoom.mdThe index of every part is at /llms.txt.