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>
| Prop | Type | Default | Description |
|---|---|---|---|
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 | number | 2 | Magnification applied while zoomed. Values below `1` clamp to `1`. |
disabled | boolean | false | Disables all zoom interaction. |
showIndicator | boolean | true | Renders 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 | boolean | false | Initial 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. |