Gathering detailed insights and metrics for react-moveable
Gathering detailed insights and metrics for react-moveable
Gathering detailed insights and metrics for react-moveable
Gathering detailed insights and metrics for react-moveable
Moveable! Draggable! Resizable! Scalable! Rotatable! Warpable! Pinchable! Groupable! Snappable!
npm install react-moveable
Typescript
Module System
Node Version
NPM Version
97.7
Supply Chain
99.3
Quality
76.1
Maintenance
100
Vulnerability
99.6
License
0.53.0 Release (2023-12-03)
Updated on Dec 03, 2023
0.52.0 Release (2023-10-28)
Updated on Oct 28, 2023
0.51.2 Release (2023-09-20)
Updated on Sep 19, 2023
0.51.1 Release (2023-07-12)
Updated on Jul 11, 2023
0.51.0 Release (2023-07-09)
Updated on Jul 09, 2023
0.50.2 Release (2023-07-05)
Updated on Jul 04, 2023
TypeScript (89.82%)
HTML (4.65%)
JavaScript (4.08%)
CSS (0.95%)
Vue (0.4%)
Svelte (0.1%)
Total Downloads
10,641,681
Last Day
7,692
Last Week
179,184
Last Month
679,236
Last Year
5,302,451
MIT License
10,463 Stars
1,612 Commits
649 Forks
76 Watchers
22 Branches
38 Contributors
Updated on Aug 02, 2025
Latest Version
0.56.0
Package Id
react-moveable@0.56.0
Unpacked Size
4.41 MB
Size
804.96 kB
File Count
136
NPM Version
8.3.1
Node Version
16.14.0
Published on
Dec 03, 2023
Cumulative downloads
Total Downloads
Last Day
41.1%
7,692
Compared to previous day
Last Week
4.1%
179,184
Compared to previous week
Last Month
8.3%
679,236
Compared to previous month
Last Year
138.1%
5,302,451
Compared to previous year
13
51
A React Component that create Moveable, Draggable, Resizable, Scalable, Rotatable, Warpable, Pinchable, Groupable, Snappable.
Demo / Storybook / API / Main Project
Moveable | |||
---|---|---|---|
Draggable | Resizable | Scalable | Rotatable |
![]() |
![]() |
![]() |
![]() |
Warpable | Pinchable | Groupable | Snappable |
![]() | ![]() | ![]() | ![]() |
Clippable | Roundable | OriginDraggable | Selecto |
![]() | ![]() | ![]() | ![]() |
1$ npm i react-moveable
1import Moveable from "react-moveable"; 2 3render() { 4 return ( 5 <Moveable 6 target={document.querySelector(".target")} 7 container={null} 8 origin={true} 9 10 /* Resize event edges */ 11 edge={false} 12 13 /* draggable */ 14 draggable={true} 15 throttleDrag={0} 16 onDragStart={({ target, clientX, clientY }) => { 17 console.log("onDragStart", target); 18 }} 19 onDrag={({ 20 target, 21 beforeDelta, beforeDist, 22 left, top, 23 right, bottom, 24 delta, dist, 25 transform, 26 clientX, clientY, 27 }: OnDrag) => { 28 console.log("onDrag left, top", left, top); 29 // target!.style.left = `${left}px`; 30 // target!.style.top = `${top}px`; 31 console.log("onDrag translate", dist); 32 target!.style.transform = transform; 33 }} 34 onDragEnd={({ target, isDrag, clientX, clientY }) => { 35 console.log("onDragEnd", target, isDrag); 36 }} 37 38 /* When resize or scale, keeps a ratio of the width, height. */ 39 keepRatio={true} 40 41 /* resizable*/ 42 /* Only one of resizable, scalable, warpable can be used. */ 43 resizable={true} 44 throttleResize={0} 45 onResizeStart={({ target , clientX, clientY}) => { 46 console.log("onResizeStart", target); 47 }} 48 onResize={({ 49 target, width, height, 50 dist, delta, direction, 51 clientX, clientY, 52 }: OnResize) => { 53 console.log("onResize", target); 54 delta[0] && (target!.style.width = `${width}px`); 55 delta[1] && (target!.style.height = `${height}px`); 56 }} 57 onResizeEnd={({ target, isDrag, clientX, clientY }) => { 58 console.log("onResizeEnd", target, isDrag); 59 }} 60 61 /* scalable */ 62 /* Only one of resizable, scalable, warpable can be used. */ 63 scalable={true} 64 throttleScale={0} 65 onScaleStart={({ target, clientX, clientY }) => { 66 console.log("onScaleStart", target); 67 }} 68 onScale={({ 69 target, scale, dist, delta, transform, 70 clientX, clientY, 71 }: OnScale) => { 72 console.log("onScale scale", scale); 73 target!.style.transform = transform; 74 }} 75 onScaleEnd={({ target, isDrag, clientX, clientY }) => { 76 console.log("onScaleEnd", target, isDrag); 77 }} 78 79 /* rotatable */ 80 rotatable={true} 81 throttleRotate={0} 82 onRotateStart={({ target, clientX, clientY }) => { 83 console.log("onRotateStart", target); 84 }} 85 onRotate={({ 86 target, 87 delta, dist, 88 transform, 89 clientX, clientY, 90 }: onRotate) => { 91 console.log("onRotate", dist); 92 target!.style.transform = transform; 93 }} 94 onRotateEnd={({ target, isDrag, clientX, clientY }) => { 95 console.log("onRotateEnd", target, isDrag); 96 }} 97 // Enabling pinchable lets you use events that 98 // can be used in draggable, resizable, scalable, and rotateable. 99 pinchable={true} 100 onPinchStart={({ target, clientX, clientY, datas }) => { 101 // pinchStart event occur before dragStart, rotateStart, scaleStart, resizeStart 102 console.log("onPinchStart"); 103 }} 104 onPinch={({ target, clientX, clientY, datas }) => { 105 // pinch event occur before drag, rotate, scale, resize 106 console.log("onPinch"); 107 }} 108 onPinchEnd={({ isDrag, target, clientX, clientY, datas }) => { 109 // pinchEnd event occur before dragEnd, rotateEnd, scaleEnd, resizeEnd 110 console.log("onPinchEnd"); 111 }} 112 /> 113 ); 114}
If you are using React 18's concurrent mode, use flushSync
for UI sync.
1import React from 'react'; 2import ReactDOM from 'react-dom/client'; 3import { flushSync } from "react-dom"; 4 5import Moveable from "react-moveable"; 6 7 8function App() { 9 return <Moveable flushSync={flushSync} /> 10} 11 12const root = ReactDOM.createRoot(document.getElementById("root")); 13 14root.render( 15 <React.StrictMode> 16 <App /> 17 </React.StrictMode> 18);
npm start
The main project was made with react
and I used croact
to make it lighter with umd.
For development and testing, check in packages/react-moveable.
$ yarn
$ npm run packages:build
$ npm run storybook
Runs the app in the development mode.
Open http://localhost:6006 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Please give a ⭐️ if this project helped you!
If you have any questions or requests or want to contribute to moveable
or other packages, please write the issue or give me a Pull Request freely.
This project exists thanks to all the people who contribute. [Contribute].
If you find a bug, please report to us opening a new Issue on GitHub.
This project is MIT licensed.
MIT License
Copyright (c) 2019 Daybrush
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
No vulnerabilities found.
react-compat-moveable
A React Compat Component that create Moveable, Draggable, Resizable, Scalable, Rotatable, Pinchable, Groupable, Snappable.
moveable
Moveable is Draggable, Resizable, Scalable, Rotatable, Warpable, Pinchable, Groupable, Snappable.
croact-moveable
A React Compat Component that create Moveable, Draggable, Resizable, Scalable, Rotatable, Pinchable, Groupable, Snappable.
react-selecto
A React Selecto Component that allows you to select elements in the drag area using the mouse or touch.