Skip to content

capriok/Draggable-Array

Repository files navigation

Draggable Array

NPM

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>
  )
}

Edit Button

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

About

React Draggable Array Component Wrapper - Beta

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published