Explore the top 10 awesome React zoom image components to help you create interactive and engaging image galleries for your apps. These components make it easy to zoom in and out of images, pan across images, and add other features such as captions and lightboxes.
When shopping online or browsing the galary, we’d like to zoom in the image which takes small space for neat view or loading speed related resons. So here are 10 Awesome React Zoom Image Components to allow your customers to zoom the images on your ecommerce site
Add map like zooming and panning to any React element. This works on both touch devices (pinch to zoom, drag to pan) as well as with a mouse or trackpad (wheel scroll to zoom, mouse drag to pan).
npm install --save react-map-interaction
import { MapInteractionCSS } from 'react-map-interaction';
// This component uses CSS to scale your content.
// Just pass in content as children and it will take care of the rest.
const ThingMap = () => {
return (
<MapInteractionCSS>
<img src="path/to/thing.png" />
</MapInteractionCSS>
);
}
import { MapInteraction } from 'react-map-interaction';
// Use MapInteraction if you want to determine how to use the resulting translation.
const NotUsingCSS = () => {
return (
<MapInteraction>
{
({ translation, scale }) => { /* Use the passed values to scale content on your own. */ }
}
</MapInteraction>
);
}
View on GitHub: https://github.com/strateos/react-map-interaction
React library to support easy zoom, pan, pinch on various html dom elements like images and divs.
Key Features
Installation
npm install --save react-zoom-pan-pinch
or
yarn add react-zoom-pan-pinch
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>
);
};
View on GitHub: https://github.com/BetterTyped/react-zoom-pan-pinch
A responsive React image zoom component for touch and mouse. Designed for shopping site product detail. Features Include: In-place and side-by-side image enlargement, Positive or negative space guide lens options, Interaction hint, Configurable enlarged image dimensions, Optional enlarged image external render, Hover intent, Long-press gesture, Fade transitions, Basic react-slick carousel support.
Features Include:
npm install react-image-magnify
If you are upgrading from v1x to v2x, please see the release notes.
import ReactImageMagnify from 'react-image-magnify';
...
<ReactImageMagnify {...{
smallImage: {
alt: 'Wristwatch by Ted Baker London',
isFluidWidth: true,
src: watchImg300
},
largeImage: {
src: watchImg1200,
width: 1200,
height: 1800
}
}} />
...
View on GitHub: https://github.com/ethanselzer/react-image-magnify
A React component to zoom images on hover.
Installation
npm install react-img-zoom
Basic usage
The component has only four required props: the link to the image, the zoom scale, the width and height (in pixels).
import Zoom from 'react-img-zoom'
<Zoom
img="link-to-img"
zoomScale={3}
width={600}
height={600}
/>
View on GitHub: https://github.com/LeoNero/react-img-zoom
React component for desktop browsers for image zoom on mouse hover.
Install
npm install react-image-zoom --save
Usage
import React from 'react';
import ReactDOM from 'react-dom';
import ReactImageZoom from 'react-image-zoom';
const props = {width: 400, height: 250, zoomWidth: 500, img: "1.jpg"};
ReactDOM.render(<ReactImageZoom {...props} />, document.getElementById('react-app'));
View on Github: https://github.com/malaman/react-image-zoom
A react component that lets you add pinch-zoom and pan sub components. On touch you can pinch-zoom and pan the zoomed image. On desktop you can ‘pinch’ by holding down your ALT-key and do a mousedown from center of inner content onto the edges.
Install
npm install react-pinch-zoom-pan
Usage
Take a look at demo/App.js for usage, you can also run it in your local enviroment by
npm install & npm start
and open localhost:3001
import React, {Component} from 'react'
import {PinchView} from 'react-pinch-zoom-pan'
class App extends Component {
render () {
return (
<PinchView debug backgroundColor='#ddd' maxScale={4} containerRatio={((400 / 600) * 100)}>
<img src={'http://lorempixel.com/600/400/nature/'} style={{
margin: 'auto',
width: '100%',
height: 'auto'
}} />
</PinchView>
)
}
}
View on GitHub: https://github.com/gerhardsletten/react-pinch-zoom-pan
A React component that adds pan and zoom features to SVG.
Features
This component can work in four different modes depending on the selected tool:
Install
NPM
npm install --save react-svg-pan-zoom
YARN
yarn add react-svg-pan-zoom
UMD
<script src="https://unpkg.com/prop-types@15/prop-types.js"></script>
<script src="https://unpkg.com/react-svg-pan-zoom@3"></script>
View on GitHub: https://github.com/chrvadala/react-svg-pan-zoom
A pan and zoom component for React, using CSS transformations.
Zoom features
Pan features
Installation
$ npm i -D react-prismazoom
View on GitHub: https://github.com/sylvaindubus/react-prismazoom
Medium.com style image zoom for React. This library is a React.js implementation of Medium.com’s image zoom that allows for low-resolution and high-resolution images to work together for a “zooming” effect and works regardless of parent elements that have overflow: hidden or parents with transform properties.
Quickstart
npm install --save react-medium-image-zoom
import React from 'react'
import Zoom from 'react-medium-image-zoom'
import 'react-medium-image-zoom/dist/styles.css'
export const MyImg = () => (
<Zoom>
<img
alt="That Wanaka Tree, New Zealand by Laura Smetsers"
src="/path/to/thatwanakatree.jpg"
width="500"
/>
</Zoom>
)
View on GitHub: https://github.com/rpearce/react-medium-image-zoom
Enables zooming and panning an image or canvas, both mobile and desktop. Min and max zoom settings. Animated transitions.
Install
npm install react-responsive-pinch-zoom-pan --save
Usage
import React from "react";
import PinchZoomPan from "react-responsive-pinch-zoom-pan";
const App = () => {
return (
<div style={{ width: '500px', height: '500px' }}>
<PinchZoomPan>
<img alt='Test Image' src='http://picsum.photos/750/750' />
</PinchZoomPan>
</div>
);
};
View on GitHub: https://github.com/bradstiff/react-responsive-pinch-zoom-pan
Thạnks for reading !!!
#reactjs #javascript #programming