Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-sortable-item

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-sortable-item

Reorder elements in a list. Uses the native HTML5 Drag and Drop API.

  • 0.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

react-sortable-item

Reorder elements in a list. Uses the native HTML5 Drag and Drop API.

See example.

This library is different from other react-sortable libraries in that it treats the reindexing strategy as an implementation detail of the drop event. This makes managing your list state easier. It also makes it easier to accept data from other sources (other windows, files from your desktop, etc).

Install

npm install react-sortable-item

Example

import SortableItem from 'react-sortable-item'

var ExampleSortableList = React.createClass({
  handleDrop(dropPath, position, event) {},

  handleAcceptTest(event) {},

  render() {
    var list = yourRecords.map((record) => {
      return (
        <SortableItem
            key={record.id}
            type={record.type}
            data={record.path}
            handleDrop={this.handleDrop}
            handleAcceptTest={this.handleAcceptTest}>
          <li>
            <div className="li-inner">
              {record.label}
            </div>
          </li>
        </SortableItem>
      )
    })
    return (
      <ul>
        {list}
      </ul>
    )
  }
})

License

MIT

Keywords

FAQs

Package last updated on 10 Mar 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc