2.0.0 • Published 9 years ago

react-dragon v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

React Dragon NPM

A very simple drag and drop component. Did I mention it was simple?

Usage

PropertiesDescription
onDropRequired. This is the callback that executes when an item is dropped onto a <Dragon />
allowDirectly translates to event.dataTransfer.effectAllowed. Defaults to "all"
classNameAdditional css class names. This can be a string or an object. The value will be injected into the classSet React addon
effectDirectly translates to event.dataTransfer.dropEffect. Defaults to "copy"
elementWhat element to use as the wrapper for the dragon. Defaults to "div"
messageThis is the token that will be passed when a <Dragon /> is dropped onto another <Dragon /> it must be JSON serialization compatible.
React.createClass({

  render() {
    return (
      <Dragon message={ 'something' } onDrop={ this._onDrop } element="p">
        { this.props.children }
      </Dragon>
    )
  },

  _onDrop(transmission, receiver) {
    // the transmission is the message from the dragged element
    // the receiver is the message from the dropped element
  }
})
2.0.0

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago

0.1.0

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago