Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-zoom-pan-pinch

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-zoom-pan-pinch

Zoom and pan html elements in easy way

  • 2.5.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
192K
decreased by-46.26%
Maintainers
1
Weekly downloads
 
Created

What is react-zoom-pan-pinch?

The react-zoom-pan-pinch package is a React library that provides functionalities for zooming, panning, and pinching elements within a React application. It is particularly useful for creating interactive and responsive user interfaces where users need to manipulate the view of an element, such as images, maps, or any other content that benefits from zoom and pan capabilities.

What are react-zoom-pan-pinch's main functionalities?

Zoom

This feature allows users to zoom in and out of an element. The code sample demonstrates how to wrap an image with TransformWrapper and TransformComponent to enable zoom functionality.

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

function ZoomExample() {
  return (
    <TransformWrapper>
      <TransformComponent>
        <img src="path/to/image.jpg" alt="Zoomable" />
      </TransformComponent>
    </TransformWrapper>
  );
}

Pan

This feature allows users to pan around an element. The code sample shows how to enable panning on a div element by wrapping it with TransformWrapper and TransformComponent.

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

function PanExample() {
  return (
    <TransformWrapper>
      <TransformComponent>
        <div style={{ width: '500px', height: '500px', background: 'lightgray' }}>
          <p>Pan around this area</p>
        </div>
      </TransformComponent>
    </TransformWrapper>
  );
}

Pinch

This feature allows users to pinch to zoom in and out on touch devices. The code sample demonstrates how to enable pinch functionality on an image by setting the pinch property in TransformWrapper.

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

function PinchExample() {
  return (
    <TransformWrapper pinch={{ disabled: false }}>
      <TransformComponent>
        <img src="path/to/image.jpg" alt="Pinchable" />
      </TransformComponent>
    </TransformWrapper>
  );
}

Other packages similar to react-zoom-pan-pinch

Keywords

FAQs

Package last updated on 10 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc