Back to rankings

BetterTyped/react-zoom-pan-pinch

TypeScriptbettertyped.github.io/react-zoom-pan-pinch/

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

panzoominzoomoutpinchreactgesturezoomsvgfigmahtml-manipulationmiroreact-component
Star Growth
Stars
1.9k
Forks
303
Weekly Growth
โ€”
Issues
112
5001k1.5k
Jul 2019Nov 2021Mar 2024Jul 2026
Artifactsnpmnpm install react-zoom-pan-pinch
README

๐Ÿ–ผ React Zoom Pan Pinch

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

Twitter Follow

๐Ÿข 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 another BetterTyped project โ€” the whole preview below is a single link to GitHub.


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

Related repositories
davemorrissey/subsampling-scale-image-view

Android library (AAR). Highly configurable, easily extendable deep zoom view for displaying huge images without loss of detail. Perfect for photo galleries, maps, building plans etc.

JavaMavenApache License 2.0android-libraryandroid-lib
8k1.2k
open-mmlab/mmocr

OpenMMLab Text Detection, Recognition and Understanding Toolbox

PythonPyPIApache License 2.0pytorchocr
mmocr.readthedocs.io/en/dev-1.x/
4.7k779
timmywil/panzoom

A library for panning and zooming elements using CSS transforms :mag:

TypeScriptnpmMIT Licensepanzoom
timmywil.com/panzoom/
2.4k419
anvaka/panzoom

Universal pan and zoom library (DOM, SVG, Custom)

JavaScriptnpmMIT Licensepanzoomscene
anvaka.github.io/panzoom/demo/attach-via-script.html
2k314
moagrius/TileView

TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.

JavaMavenMIT Licenseandroidandroid-library
1.5k331
RxSwiftCommunity/RxGesture

RxSwift reactive wrapper for view gestures

SwiftMIT Licenserxswiftrecognizers
1.4k181
panphp/pan

A simple, lightweight, and privacy-focused product analytics php package

PHPPackagistMIT Licenseanalyticslibrary
1.3k63
any86/any-touch

:wave: Touch gesture library, 1kb~5kb, compatible with PC / mobile

TypeScriptnpmMIT Licensegesturefinger
any86.github.io/any-touch
1.2k118
natario1/ZoomLayout

2D zoom and pan behavior for View hierarchies, images, video streams, and much more, written in Kotlin for Android.

KotlinApache License 2.0androidandroid-library
natario1.github.io/ZoomLayout
1.1k149