react-draggable-array
v1.1.0
Published
React Draggable Array Component
Downloads
29
Readme
Wrapper component utilizing native browser drag API for its children. Happy dragging.
Install
Available as an npm package
npm install --save react-draggable-array
Usage
import React from 'react'
// Import the component
import DraggableArray from 'react-draggable-array'
// Import the css
import 'react-draggable-array/dist/index.css'
const App = () => {
// Define the array
const items = [ '🦜', '🦖', '🦆', '🦔', '🐤', '🐧' ]
return (
// Wrap a map of the items in the DraggableArray component
<DraggableArray>
{items.map((item) => (
<p>{item}</p>
))}
</DraggableArray>
)
}
Options
| prop | action | | :-------------|:------------- | | className | apply a className to the Wrapper Component | | row ( default ) | displays children in row orientation | | col | displays children in col orientation |
License
This project is licensed under the terms of the MIT license