Socket
Socket
Sign inDemoInstall

react-dragula

Package Overview
Dependencies
6
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-dragula

Drag and drop so simple it hurts


Version published
Weekly downloads
25K
decreased by-4.79%
Maintainers
1
Install size
3.21 MB
Created
Weekly downloads
 

Readme

Source

logo.png

Drag and drop so simple it hurts

Official React wrapper for dragula.

Demo

demo.png

Try out the demo!

Install

You can get it on npm.

npm install react-dragula --save

Or bower, too.

bower install react-dragula --save

Usage

Refer to the documentation for dragula. The API for react-dragula is identical, but a few tiny tweaks were made around it so that it works out the box with React.

Example

Here's an example application using react and react-dragula.

var React = require('react');
var dragula = require('react-dragula');
var App = React.createClass({
  render: function () {
    return <div className='container'>
      <div>Swap me around</div>
      <div>Swap her around</div>
      <div>Swap him around</div>
      <div>Swap them around</div>
      <div>Swap us around</div>
      <div>Swap things around</div>
      <div>Swap everything around</div>
    </div>;
  },
  componentDidMount: function () {
    var container = React.findDOMNode(this);
    dragula([container]);
  }
});
React.render(<App />, document.getElementById('examples'));

Example using refs (ES2015 syntax)

Here's an example using refs (ES2015 syntax): React: The ref Callback Attribute

import * as React from "react";
import * as ReactDOM from 'react-dom';
import Dragula from 'react-dragula';
export class App extends React.Component {
  render () {
    return <div className='container' ref={this.dragulaDecorator}>
      <div>Swap me around</div>
      <div>Swap her around</div>
      <div>Swap him around</div>
      <div>Swap them around</div>
      <div>Swap us around</div>
      <div>Swap things around</div>
      <div>Swap everything around</div>
    </div>;
  },
  dragulaDecorator = (componentBackingInstance) => {
    if (componentBackingInstance) {
      let options = { };
      Dragula([componentBackingInstance], options);
    }
  };
});
ReactDOM.render(<App />, document.getElementById('examples'));

License

MIT

FAQs

Last updated on 12 Sep 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc