BetterTyped/react-zoom-pan-pinch

๐Ÿ–ผ React library to support easy zoom, pan, pinch on various html dom elements like <img> and <div>

TypeScript

1,950

452 commits

updated Oct 2, 2026

See the code

README

react-zoom-pan-pinch

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

Twitter Follow

Join our Discord community

๐Ÿข 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

Premium sponsor banner

Premium sponsor banner

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.

Build your SaaS on Hype Stack

Connect any API with Hyper Fetch


Installation

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

Premium sponsor banner

Premium sponsor banner

Examples

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

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>
  );
};

Premium sponsor banner

Premium sponsor banner

Help me keep working on this project โค๏ธ

๐Ÿ’– Our sponsors

My Sponsors

๐Ÿข 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

figma
gesture
html-manipulation
miro
pan
pinch
react
react-component
svg
zoom
zoomin
zoomout

BetterTyped/react-zoom-pan-pinch

๐Ÿ–ผ React library to support easy zoom, pan, pinch on various html dom elements like <img> and <div>

TypeScript

1,950

452 commits

updated Oct 2, 2026

See the code

README

react-zoom-pan-pinch

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

Twitter Follow

Join our Discord community

๐Ÿข 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

Premium sponsor banner

Premium sponsor banner

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.

Build your SaaS on Hype Stack

Connect any API with Hyper Fetch


Installation

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

Premium sponsor banner

Premium sponsor banner

Examples

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

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>
  );
};

Premium sponsor banner

Premium sponsor banner

Help me keep working on this project โค๏ธ

๐Ÿ’– Our sponsors

My Sponsors

๐Ÿข 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

figma
gesture
html-manipulation
miro
pan
pinch
react
react-component
svg
zoom
zoomin
zoomout

Project health

Latest release

4.2.0 ยท Sep 3, 2026

Releases this year

11

Significant stargazers

CanisMinor

892 followers ยท starred Mar 2025

Connor Doyle

167 followers ยท starred Jul 2020

Evan Simkowitz

145 followers ยท starred Jan 2025

Jeff Wainwright

229 followers ยท starred Feb 2026