# react-zoom-pan-pinch

> Zoom and pan html elements in easy way.

Latest version **4.2.0** (published 2026-09-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-zoom-pan-pinch
pnpm add react-zoom-pan-pinch
yarn add react-zoom-pan-pinch
bun add react-zoom-pan-pinch
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.2.0 |
| Published | 2026-09-03 |
| First published | 2019-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1920 |
| Author | prc5 |
| Maintainers | prc5 |
| Keywords | react, zoom, pan, pinch, animation, velocity, css, fast, transformations, scale, drag, viewer, reacts, touch, css3, svg, bounds, context |

## Links

- npm: https://www.npmjs.com/package/react-zoom-pan-pinch
- Repository: https://github.com/BetterTyped/react-zoom-pan-pinch
- Homepage: https://github.com/BetterTyped/react-zoom-pan-pinch#readme
- Issues: https://github.com/BetterTyped/react-zoom-pan-pinch/issues
- npm.io page: https://npm.io/package/react-zoom-pan-pinch

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 4.2.0 (latest) — 2026-09-03
- 4.1.1 — 2026-09-02
- 4.1.0 — 2026-09-01
- 4.0.7 — 2026-09-01
- 4.0.6 — 2026-09-01
- 4.0.5 — 2026-09-01
- 4.0.4 — 2026-08-03
- 4.0.3 — 2026-04-07
- 4.0.2 — 2026-04-07
- 4.0.1 — 2026-04-07
- 4.0.0 — 2026-04-07
- 3.7.0 — 2025-01-31
- 3.6.1 — 2024-07-01
- 3.6.0 — 2024-06-27
- 3.5.1 — 2024-06-23
- … 65 more at https://npm.io/package/react-zoom-pan-pinch/versions

## README

<p>
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset=".github/assets/logo-lockup-dark.png">
    <img src=".github/assets/logo-lockup-light.png" alt="react-zoom-pan-pinch" width="524">
  </picture>
</p>

> Super fast and light react npm package for zooming, panning and pinching html
> elements in easy way

<p>
  <a href="https://bettertyped.com/">
    <img src="https://custom-icon-badges.demolab.com/static/v1?label=&message=BetterTyped&color=333&logo=BT" />
  </a>
  <a href="https://www.npmjs.com/package/react-zoom-pan-pinch">
    <img src="https://custom-icon-badges.demolab.com/npm/v/react-zoom-pan-pinch.svg?logo=npm&color=e22121"/>
  </a>
  <a href="https://github.com/BetterTyped/react-zoom-pan-pinch">
    <img src="https://custom-icon-badges.demolab.com/github/stars/BetterTyped/react-zoom-pan-pinch?logo=star&style=flat" />
  </a>
  <a href="https://github.com/BetterTyped/react-zoom-pan-pinch/blob/main/License.md">
    <img src="https://custom-icon-badges.demolab.com/github/license/BetterTyped/react-zoom-pan-pinch?logo=law&color=yellow" />
  </a>
  <a href="https://github.com/semantic-release/semantic-release">
    <img src="https://custom-icon-badges.demolab.com/badge/semver-commitzen-e10079?logo=semantic-release&color=e76f51" />
  </a>
  <a href="https://www.npmjs.com/package/react-zoom-pan-pinch">
    <img src="https://custom-icon-badges.demolab.com/npm/dm/react-zoom-pan-pinch?logoColor=fff&logo=trending-up" />
  </a>
  <a href="https://www.npmjs.com/package/react-zoom-pan-pinch">
    <img src="https://custom-icon-badges.demolab.com/bundlephobia/minzip/react-zoom-pan-pinch?color=E10098&logo=package" />
  </a>
  <a href="https://github.com/BetterTyped/react-zoom-pan-pinch">
    <img src="https://custom-icon-badges.demolab.com/badge/typescript-%23007ACC.svg?logo=typescript&logoColor=white" />
  </a>
  <a href="https://hits.sh/github.com/BetterTyped/react-zoom-pan-pinch/">
    <img src="https://hits.sh/github.com/BetterTyped/react-zoom-pan-pinch.svg?color=64BC4B&logo=bookmeter" />
  </a>
  <a href="https://twitter.com/maciej_pyrc">
    <img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/maciej_pyrc"/>
  </a>
</p>

<p align="center">
  <a href="https://www.hype-stack.dev/discord">
    <img src="./.github/assets/discord.png" alt="Join our Discord community" />
  </a>
</p>

## 🏢 Using this library in production?

If your application depends on react-zoom-pan-pinch, I offer paid support to
help you resolve issues quickly and avoid blocking releases.

#### Sources

- [Demo](https://bettertyped.github.io/react-zoom-pan-pinch/?path=/story/basic-image--image)
- [Docs](https://bettertyped.github.io/react-zoom-pan-pinch/?path=/docs/docs-props--docs)

<p align="center">
	<a href="https://github.com/sponsors/prc5?tier=platinum">
		<picture>
			<img width="830" src="https://raw.githubusercontent.com/prc5/sponsors/main/assets/Platinum.png" alt="Premium sponsor banner"/>
		</picture>
	</a>
</p>

<p align="center">
	<a href="https://github.com/sponsors/prc5?tier=Platinum">
		<picture>
			<img width="830" src="https://raw.githubusercontent.com/prc5/sponsors/main/packages/platinum/sponsorkit/sponsors.svg" alt="Premium sponsor banner"/>
		</picture>
	</a>
</p>

## Key Features

- 🚀 Fast and easy to use
- 🏭 Light, without external dependencies
- 💎 Mobile gestures, touchpad gestures and desktop mouse events support
- 🎁 Powerful context usage, which gives you a lot of freedom
- 🔧 Highly customizable
- 👑 Animations and Utils to create own tools
- 🔮 Advanced hooks and components

## Try other BetterTyped projects

Do you like this library? Here is what else I build and maintain.

<p align="center">
  <a href="https://github.com/BetterTyped/hype-stack">
    <img src="./.github/assets/banner-hype-stack.png" alt="Build your SaaS on Hype Stack" />
  </a>
</p>

<p align="center">
  <a href="https://github.com/BetterTyped/hyper-fetch">
    <img src="./.github/assets/banner-hyper-fetch.png" alt="Connect any API with Hyper Fetch" />
  </a>
</p>

---

## Installation

```bash
npm install --save react-zoom-pan-pinch
or
yarn add react-zoom-pan-pinch
```

<p align="center">
	<a href="https://github.com/sponsors/prc5?tier=Gold">
		<picture>
			<img width="830" src="https://raw.githubusercontent.com/prc5/sponsors/main/assets/Gold.png" alt="Premium sponsor banner"/>
		</picture>
	</a>
</p>

<p align="center">
	<a href="https://github.com/sponsors/prc5?tier=gold">
		<picture>
			<img width="830" src="https://raw.githubusercontent.com/prc5/sponsors/main/packages/gold/sponsorkit/sponsors.svg" alt="Premium sponsor banner"/>
		</picture>
	</a>
</p>

## Examples

```jsx
import React, { Component } from "react";

import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";

const Example = () => {
  return (
    <TransformWrapper>
      <TransformComponent>
        <img src="image.jpg" alt="test" />
      </TransformComponent>
    </TransformWrapper>
  );
};
```

or

```jsx
import {
  TransformWrapper,
  TransformComponent,
  useControls,
} from "react-zoom-pan-pinch";

const Controls = () => {
  const { zoomIn, zoomOut, resetTransform } = useControls();

  return (
    <div className="tools">
      <button type="button" onClick={() => zoomIn()}>
        +
      </button>
      <button type="button" onClick={() => zoomOut()}>
        -
      </button>
      <button type="button" onClick={() => resetTransform()}>
        x
      </button>
    </div>
  );
};

const Example = () => {
  return (
    <TransformWrapper
      initialScale={1}
      initialPositionX={200}
      initialPositionY={100}
    >
      <Controls />
      <TransformComponent>
        <img src="image.jpg" alt="test" />
        <div>Example text</div>
      </TransformComponent>
    </TransformWrapper>
  );
};
```

<p align="center">
	<a href="https://github.com/sponsors/prc5?tier=Silver">
		<picture>
			<img width="830" src="https://raw.githubusercontent.com/prc5/sponsors/main/assets/Silver.png" alt="Premium sponsor banner" />
		</picture>
	</a>
</p>

<p align="center">
	<a href="https://github.com/sponsors/prc5?tier=Silver">
		<picture>
			<img width="830" src="https://raw.githubusercontent.com/prc5/sponsors/main/packages/silver/sponsorkit/sponsors.svg" alt="Premium sponsor banner" />
		</picture>
	</a>
</p>

## Help me keep working on this project ❤️

- [Become a Sponsor on GitHub](https://github.com/sponsors/prc5)

## 💖 Our sponsors

<p align="center">
	<a href="https://github.com/sponsors/prc5">
		<img src="https://raw.githubusercontent.com/prc5/sponsors/main/packages/other/sponsorkit/sponsors.svg?raw=true" alt="My Sponsors" />
	</a>
</p>

## 🏢 Commercial Support

If you're using this library in production, I offer paid support:

- Priority issue resolution
- Help with debugging production issues
- Direct contact with the maintainer

Plans start at $400/month.

📩 Contact: maciekpyrc@gmail.com

## License

MIT © [prc5](https://github.com/prc5)

---
_Source: https://npm.io/package/react-zoom-pan-pinch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
