Skip to content

cathcheeno/react-droparea

 
 

Repository files navigation

Droparea - HTML5 file Drag and Drop component

Instalation

npm install react-droparea

Usage

React = require 'react'
{div} = React.DOM
Dragarea = React.createFactory(require '../index')

App = React.createClass

  _onDrop: (file) ->
    console.log file

  _onRootDrop: ->
    console.log 'root'

  render: ->
    div null,
      Dragarea
        onDrop: @_onRootDrop,

        for item in [1..10]
          Dragarea
            className: 'droparea-item'
            key: item
            onDrop: @_onDrop,
              div 'Totally placeholder 1'
              div 'Totally placeholder 2'
              div 'Totally placeholder 3'

React.render(React.createElement(App), document.getElementById('app'))

You can fiddle with prepared demo. Clone the repo, npm install and npm start. Then visit localhost:3000.

Options - React props

disableClick: React.PropTypes.bool
onDrag: React.PropTypes.func
dropEffect: React.PropTypes.string
onDrop: React.PropTypes.func.isRequired
className: React.PropTypes.string
activeClassName: React.PropTypes.string
multiple: React.PropTypes.bool
supportedFormats: React.PropTypes.arrayOf(React.PropTypes.string)

Credits

This library is inspired by react-dropzone by Param Aggarwal.

About

Drag and Drop library for React

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CoffeeScript 53.8%
  • JavaScript 32.7%
  • HTML 11.1%
  • Shell 2.4%