Image zoom for the web. Since 2016.

Bring images closer with JavaScript

Lightweight image zoom for the web.
Zero dependencies, any framework, React via shadcn.

Package manager
npm install medium-zoompnpm add medium-zoomyarn add medium-zoombun add medium-zoom

Try the zoom.

Scroll to explore
Landscape
Ocean sunsetPress Enter or Space to zoom. Click, press Escape, or scroll to close.
Portrait
Garden catPress Enter or Space to zoom. Click, press Escape, or scroll to close.
Source: NPS
Denali at sunrisePress Enter or Space to zoom. Click, press Escape, or scroll to close.
Source: NASA
Earth from spacePress Enter or Space to zoom. Click, press Escape, or scroll to close.
Source: NPS
Roosevelt ArchPress Enter or Space to zoom. Click, press Escape, or scroll to close.
Source: NPS
Aurora over YellowstonePress Enter or Space to zoom. Click, press Escape, or scroll to close.

3 kB. Zero dependencies.

A lightweight lightbox alternative.

Any framework. TypeScript ready.

Use with React, Angular, Vue, Svelte, Astro, or plain HTML.

High-resolution on demand.

Load sharper images only when zooming.

Pick your images.

Add data-zoomable to your images, then attach the zoom. Styles come included.

app.js
import mediumZoom from 'medium-zoom'

mediumZoom('[data-zoomable]', {
  margin: 24,
  background: 'var(--background, #fff)',
})

Set the spacing, match your background, or load a sharper image on zoom. Read the API reference

Start with your stack.

The same zoom, wherever you build.

React + TypeScript

A component you own.

Install with the shadcn CLI. Own the source. Match your theme.

Explore shadcn/ui

Add zoom to your project.

Start with a few lines of JavaScript.

Package manager
npm install medium-zoompnpm add medium-zoomyarn add medium-zoombun add medium-zoom
Read the documentation