Skip to main content
GitHub
1 min read

Components

Image Zoom

Click-to-zoom images with medium-zoom

Add click-to-zoom functionality to images. Powered by medium-zoom.

Basic Usage

Barodoc Logo

Click the image above to zoom in. Click again or press Esc to close.

<ImageZoom client:load src="/images/screenshot.png" alt="Screenshot" />

With High-Resolution Zoom Source

Use zoomSrc to load a higher-resolution image when zoomed:

<ImageZoom
  client:load
  src="/images/thumbnail.png"
  zoomSrc="/images/full-resolution.png"
  alt="Architecture diagram"
/>

With Custom Dimensions

<ImageZoom client:load src="/images/diagram.png" alt="Diagram" width={600} height={400} />

Props

srcstringrequired

Image source URL

altstring

Alt text for accessibility

zoomSrcstring

Higher-resolution image URL loaded when zoomed

widthnumber

Image width in pixels

heightnumber

Image height in pixels

client:loaddirectiverequired

Required Astro directive for client-side interactivity