
Description
react-svg-pan-zoom is a React component that adds pan and zoom to SVG images, so large SVG images can be shown in a small space. The viewer has four tools. The pan tool moves the image by dragging but does not let you interact with SVG child elements. The zoom tool scales the image with a click on a point or by selecting a region, and it also blocks child element interaction. The none tool lets you interact with child elements and trigger their events. The auto tool combines the others: you can interact with child elements, pan by dragging, zoom in with a double click and zoom out with a double click and shift. The docs cover getting started, props, methods, the API, an autosized viewer and loading SVG dynamically. It can be installed from npm or yarn, or used as a UMD bundle. There is a live demo, basic and uncontrolled examples, and JSFiddle and CodeSandbox demos. The changelog records updates such as touch events support, the auto tool, the preventPanOutside and scaleFactor props, and a switch to transformation-matrix to reduce bundle size.…
Highlights
- Pan and zoom for SVG images in React
- Pan, zoom, none and auto tools
- Touch events support
- Props and methods for control
- Installs from npm, yarn or UMD
- Tree-shaking friendly build
Ratings & Reviews
No ratings yet
Be the first to rate react-svg-pan-zoom.
People also visit

react-inner-image-zoom
A React component for magnifying an image within its parent container
react-svg-pan-zoom FAQ
What does it do?
It adds pan and zoom to SVG images in a React component, so large SVGs fit in a small viewer.
How do I install it?
Install from npm or yarn, or use the UMD bundle in a plain web page.
Which tool should I use?
Pan or zoom only, none to interact with child elements, or auto to combine panning, zooming and element interaction.
Does it support touch?
Yes. Touch events support was added in version 2.3.
Where is a demo?
The project has a live demo, and basic and uncontrolled examples are linked on CodeSandbox and JSFiddle.
What are the best react-svg-pan-zoom alternatives?
Popular alternatives to react-svg-pan-zoom include react-svg-pan-zoom, react-easy-panzoom and react-prismazoom. See all react-svg-pan-zoom alternatives




















