Skip to content
Display

Image Zoom

Inline hover/press zoom that magnifies product imagery and pans with the cursor.

Import

tsx
import { ImageZoom } from "@cronus-ui/ui";
bash
npx cronus-ui add image-zoom

Examples

.cronus

The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.

PortedParity: MatchGeometry 1/1Pixel diff 0 pxLogic 1/1Parity scoreboard
default.cronus
app "audit-fixtures" {
  port 5176
}

style {
  preset aurora
  theme dark
}

component ImageZoomDefault layout:inline style:image-zoom {
  label "Zoom"
}

page "/audit/image-zoom/default" type:custom {
  use ImageZoomDefault
}

API Reference

Generated from the component's exported types.

ImageZoomLabels

Skip ImageZoomLabels props table
PropTypeDefaultDescription
zoom*
string2Action part of the toggle's accessible name; `alt` is appended when set.

ImageZoomProps

Extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof imageZoomVariants>

Skip ImageZoomProps props table
PropTypeDefaultDescription
src
string—Image URL for the built-in `<img>`. Ignored when `children` is passed.
alt
string""Describes the image for assistive tech. The root is a button whose `aria-label` overrides the inner image's alt, so the description is composed into the toggle's accessible name (`"{labels.zoom}: {alt}"`) in addition to serving as the built-in `<img>` alt.
zoom
number2Magnification applied while zoomed. Values below `1` clamp to `1`.
disabled
booleanfalseDisables all zoom interaction.
showIndicator
booleantrueRenders the zoom-in indicator overlay, which fades out while zoomed.
labels
Partial<ImageZoomLabels>—Assistive strings, merged over the English defaults.
zoomed
boolean—Controlled zoom state. Pair with `onZoomChange`.
defaultZoomed
booleanfalseInitial zoom state for uncontrolled usage.
onZoomChange
(zoomed: boolean) => void—Called with the next state whenever zoom toggles on or off.
children
ReactNode—Custom image markup to zoom instead of the built-in `src` image.
asChild
boolean—Render as the child element via Slot.
className
string—Additional class names merged onto the root.
type
string—Native type of the underlying element.
onClick
(event: MouseEvent) => void—Click handler.