Skip to content
Data 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

API Reference

Generated from the component's exported types.

ImageZoomProps

Extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof imageZoomVariants>

Skip ImageZoomProps props table
PropTypeDefaultDescription
src
stringImage 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
booleanControlled zoom state. Pair with `onZoomChange`.
defaultZoomed
booleanfalseInitial zoom state for uncontrolled usage.
onZoomChange
(zoomed: boolean) => voidCalled with the next state whenever zoom toggles on or off.
children
ReactNodeCustom image markup to zoom instead of the built-in `src` image.