Gathering detailed insights and metrics for react-drag-sortable-plus
Gathering detailed insights and metrics for react-drag-sortable-plus
Gathering detailed insights and metrics for react-drag-sortable-plus
Gathering detailed insights and metrics for react-drag-sortable-plus
npm install react-drag-sortable-plus
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
72 Commits
7 Branches
1 Contributors
Updated on May 05, 2022
Latest Version
1.1.9
Package Id
react-drag-sortable-plus@1.1.9
Unpacked Size
26.23 kB
Size
7.65 kB
File Count
3
NPM Version
6.13.7
Node Version
12.14.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
25
Fork and update the project, since the author does not maintain this anymore.
Please note I don't maintain this project anymore, as I think there are now better alternatives out there
1npm install react-drag-sortable
Make a list of elements (array) sortable by drag and drop. Allows to specify a customizable placeholder to be displayed on the drop area. Allows to customize the style of items at every step (normal, being dragged, placeholder). The component supports both horizontal and vertical lists. The component uses interact.js for crossbrowser dragging (see http://interactjs.io for more details). Works with items of variables width (in %) as well as static width.
SUPPORTS IOS AND TOUCH GESTURES (tested on ipad and safari)
Import the component :
1import DragSortableList from 'react-drag-sortable'
Use the component :
1<DragSortableList items={list} placeholder={placeholder} onSort={onSort} dropBackTransitionDuration={0.3} type="vertical"/> 2<DragSortableList items={list} onSort={onSort} type="horizontal"/>
You can pass the following properties:
1 var list = [ 2 {content: (<div>test1</div>), classes:['bigger']}, 3 {content: (<div>test2</div>)}, 4 {content: (<div>test3</div>), classes:['bigger']}, 5 {content: (<div>test4</div>)} 6];
1var placeholder = ( 2 <div className="placeholderContent">PLACEHOLDER</div> 3);
1 var onSort = function(sortedList, dropEvent) { 2 console.log("sortedList", sortedList, dropEvent); 3 }
1ReactDOM.render(<DragSortableList items={list} placeholder={placeholder} onSort={onSort} type="vertical"/>, document.getElementById('main'));
The list elements all have a class .draggable The element being dragged has a class .dragged while it's being dragged The placeholder has a class .placeholder
For instance, you can customize the style :
1.draggable { 2 background-color: yellow; 3 margin: 10px; 4} 5 6.dragged { 7 opacity: 0.7; 8} 9 10.placeholder { 11 opacity: 0.5; 12}
You can mix your custom classes ("classes" property in items list) with these classes for powerful styling. You will find more complex examples of styling in the example folder.
You can prevent an element of being draggable by adding the class "no-drag". This examples contains a list where the texts are draggable but not the inputs.
1const listWithNoDrag = [ 2 {content: (<div>test1<input type='text' className='no-drag'/></div>)}, 3 {content: (<div>test2<input type='text' className='no-drag'/></div>)}, 4 {content: (<div>test3<input type='text' className='no-drag'/></div>)}, 5] 6ReactDOM.render(<DragSortableList items={listWithNoDrag} onSort={onSort}/>, document.getElementById('main'));
Prevent children from dragging. version: 1.0.6
Those children sometimes may from the third lib(like antd), or we can't easily code className no-drag
.
Default is ['no-drag']
, which you can use no-drag
directly without setting and no breaking on exited 'no-drag'.
1<div className="sub-list"> 2 <DragSortableList 3 type="vertical" 4 ignoreDragCls = {['no-drag', 'ant-input', 'other-class']} 5 onSort={this.onSort} 6 items={ list } 7 /> 8</div>
1require('./stylesheets/styles.scss'); 2 3import React from 'react' 4import ReactDOM from 'react-dom' 5 6// Components 7import DragSortableList from '../src/dragSortableList.jsx' 8 9var placeholder = ( 10 <div className="placeholderContent"> DROP HERE ! </div> 11); 12 13var list = [ 14 {content: (<span>test1</span>), classes:['test', 'bigger']}, 15 {content: (<span>test2</span>), classes:['test']}, 16 {content: (<span>test3</span>), classes:['test']}, 17 {content: (<span>test4</span>), classes:['test', 'bigger']} 18]; 19 20var listHorizontal = [ 21 {content: (<div>test1</div>), classes:['bigger']}, 22 {content: (<div>test2</div>)}, 23 {content: (<div>test3</div>), classes:['bigger']}, 24 {content: (<div>test4</div>)} 25]; 26 27var listGrid = [ 28 {content: (<div>test1</div>)}, 29 {content: (<div>test2</div>)}, 30 {content: (<div>test3</div>)}, 31 {content: (<div>test4</div>)}, 32 {content: (<div>test5</div>)}, 33 {content: (<div>test6</div>)}, 34 {content: (<div>test7</div>)}, 35 {content: (<div>test8</div>)}, 36 {content: (<div>test9</div>)} 37]; 38 39 var onSort = function(sortedList) { 40 console.log("sortedList", sortedList); 41 } 42 43ReactDOM.render(<DragSortableList items={list} moveTransitionDuration={0.3} onSort={onSort} type="vertical"/>, document.getElementById('example1')); 44ReactDOM.render(<DragSortableList items={listHorizontal} moveTransitionDuration={0.3} dropBackTransitionDuration={0.3} placeholder={placeholder} onSort={onSort} type="horizontal"/>, document.getElementById('example2')); 45ReactDOM.render(<DragSortableList items={listGrid} dropBackTransitionDuration={0.3} onSort={onSort} type="grid"/>, document.getElementById('example3'));
The example (containing both vertical and horizontal lists along with more complex styling) can be found in the demo folder and run using webpack with
1npm run dev
These will be added soon. Please do not hesitate to add some !
I am a full-stack Javascript developer based in Lyon, France.
react-drag-sortable is dual licensed under the MIT license and GPL. For more information click here.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
92 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More