Skip to content
caliper ui pro docs

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.

Pro

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

terminal
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
PropTypeDefaultDescription
src *string—
zoomSrcstring—A sharper file for the open view.
alt *string—
width *number—The image's pixel size, so the space is held before it loads.
height *number—
classNamestring—
imageClassNamestring—

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.md

The index of every part is at /llms.txt.

More in Compare & browse