All Projects → JakeSidSmith → React Reorder

JakeSidSmith / React Reorder

Licence: mit
Drag & drop, touch enabled, reorderable / sortable list, React component

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Reorder

Ngx Sortablejs
Angular 2+ binding to SortableJS. Previously known as angular-sortablejs
Stars: ✭ 397 (+89.95%)
Mutual labels:  drag, drop, sortable
Ngx Smooth Dnd
angular wrapper for smooth-dnd
Stars: ✭ 152 (-27.27%)
Mutual labels:  drag, drop, sortable
React Smooth Dnd
react wrapper components for smooth-dnd
Stars: ✭ 1,560 (+646.41%)
Mutual labels:  drag, drop, sortable
Smooth Dnd
drag and drop library for javascript
Stars: ✭ 408 (+95.22%)
Mutual labels:  drag, drop, sortable
Angular Skyhook
An implementation of react-dnd for Angular.
Stars: ✭ 146 (-30.14%)
Mutual labels:  drag, drop, sortable
Vue Smooth Dnd
Vue wrapper components for smooth-dnd
Stars: ✭ 1,121 (+436.36%)
Mutual labels:  drag, drop, sortable
React Magnifier
🔍 React image zoom component
Stars: ✭ 116 (-44.5%)
Mutual labels:  component, react-component
React Splitters
React splitter component, written in TypeScript.
Stars: ✭ 127 (-39.23%)
Mutual labels:  component, react-component
Fullrecyclerview
This is a compilation of different kinds and actions in recyclerView
Stars: ✭ 127 (-39.23%)
Mutual labels:  drag, drop
React Multi Select
A Multi Select component built with and for React
Stars: ✭ 111 (-46.89%)
Mutual labels:  component, react-component
Dnd Kit
A modern, lightweight, performant, accessible and extensible drag & drop toolkit for React.
Stars: ✭ 3,456 (+1553.59%)
Mutual labels:  sortable, drag
Angular Tree Dnd
Display tree table (or list) & event Drap & Drop (allow drag multi tree-table include all type: table, ol, ul) by AngularJS
Stars: ✭ 146 (-30.14%)
Mutual labels:  drag, drop
Gong Wpf Dragdrop
The GongSolutions.WPF.DragDrop library is a drag'n'drop framework for WPF
Stars: ✭ 1,669 (+698.56%)
Mutual labels:  drag, drop
Vue Upload Component
Vue.js file upload component, Multi-file upload, Upload directory, Drag upload, Drag the directory, Upload multiple files at the same time, html4 (IE 9), `PUT` method, Customize the filter
Stars: ✭ 2,422 (+1058.85%)
Mutual labels:  component, drag
Zhpopupcontroller
Help you pop up custom views easily. and support pop-up animation, layout position, mask effect and gesture interaction etc.
Stars: ✭ 1,481 (+608.61%)
Mutual labels:  drag, drop
Vue3 Draggable Resizable
[Vue3 组件] 用于拖拽调整位置和大小的的组件,同时支持冲突检测,元素吸附对齐,实时参考线。
Stars: ✭ 159 (-23.92%)
Mutual labels:  component, drag
Vuegg
🐣 vue GUI generator
Stars: ✭ 2,056 (+883.73%)
Mutual labels:  drag, drop
Diagram Maker
A library to display an interactive editor for any graph-like data.
Stars: ✭ 2,086 (+898.09%)
Mutual labels:  drag, drop
React Component Echarts
React component echarts. 组件式百度图表。
Stars: ✭ 175 (-16.27%)
Mutual labels:  component, react-component
Reactjs Popup
React Popup Component - Modals,Tooltips and Menus —  All in one
Stars: ✭ 1,211 (+479.43%)
Mutual labels:  component, react-component

React Reorder (v2)

Drag & drop, touch enabled, reorder / sortable list, React component

If you are using v3 alpha, please refer to this documentation.

About

React Reorder is a React component that allows the user to drag-and-drop items in a list (horizontal / vertical) or a grid.

It fully supports touch devices and auto-scrolls when a component is being dragged (check out the demo, link below).

It also allows the user to set a hold time (duration before drag begins) allowing additional events like clicking / tapping to be applied.

Although this project is very new, it has been thoroughly tested in all modern browsers (see supported browsers).

Demo

Installation

  • Using npm

    npm install react-reorder
    

    Add --save or -S to update your package.json

  • Using bower

    bower install react-reorder
    

    Add --save or -S to update your bower.json

Example

  1. If using requirejs: add react-reorder to your require.config

    paths:
      // <name> : <path/to/module>
      'react-reorder': 'react-reorder/reorder'
    }
    
  2. If using a module loader (requirejs / browserfiy / commonjs): require react-reorder where it will be used in your project

    var Reorder = require('react-reorder');
    

    If using requirejs you'll probably want to wrap your module e.g.

    define(function (require) {
      // Require react-reorder here
    });
    
  3. Configuration

    Note: If your array is an array of primitives (e.g. strings) then itemKey is not required as the string itself will be used as the key, however item keys must be unique in any case

    1. Using JSX

      <Reorder
        // The key of each object in your list to use as the element key
        itemKey='name'
        // Lock horizontal to have a vertical list
        lock='horizontal'
        // The milliseconds to hold an item for before dragging begins
        holdTime='500'
        // The list to display
        list={[
          {name: 'Item 1'},
          {name: 'Item 2'},
          {name: 'Item 3'}
        ]}
        // A template to display for each list item
        template={ListItem}
        // Function that is called once a reorder has been performed
        callback={this.callback}
        // Class to be applied to the outer list element
        listClass='my-list'
        // Class to be applied to each list item's wrapper element
        itemClass='list-item'
        // A function to be called if a list item is clicked (before hold time is up)
        itemClicked={this.itemClicked}
        // The item to be selected (adds 'selected' class)
        selected={this.state.selected}
        // The key to compare from the selected item object with each item object
        selectedKey='uuid'
        // Allows reordering to be disabled
        disableReorder={false}
      />
      
    2. Using standard Javascript

      React.createElement(Reorder, {
        // The key of each object in your list to use as the element key
        itemKey: 'name',
        // Lock horizontal to have a vertical list
        lock: 'horizontal',
        // The milliseconds to hold an item for before dragging begins
        holdTime: '500',
        // The list to display
        list: [
          {name: 'Item 1'},
          {name: 'Item 2'},
          {name: 'Item 3'}
        ],
        // A template to display for each list item
        template: ListItem,
        // Function that is called once a reorder has been performed
        callback: this.callback,
        // Class to be applied to the outer list element
        listClass: 'my-list',
        // Class to be applied to each list item's wrapper element
        itemClass: 'list-item',
        // A function to be called if a list item is clicked (before hold time is up)
        itemClicked: this.itemClicked,
        // The item to be selected (adds 'selected' class)
        selected: this.state.selected,
        // The key to compare from the selected item object with each item object
        selectedKey: 'uuid',
        // Allows reordering to be disabled
        disableReorder: false
      })
      
  4. Callback functions

    1. The callback function that is called once a reorder has been performed

      function callback(event, itemThatHasBeenMoved, itemsPreviousIndex, itemsNewIndex, reorderedArray) {
        // ...
      }
      
    2. The itemClicked function that is called when an item is clicked before any dragging begins

      function itemClicked(event, itemThatHasBeenClicked, itemsIndex) {
        // ...
      }
      

      Note: event will be the synthetic React event for either mouseup or touchend, and both contain clientX & clientY values (for ease of use)

Compatibility / Requirements

  • Version 2.x tested and working with React 0.14

  • Versions 1.x tested and working with React 0.12 - 0.13

  • requirejs / commonjs / browserify (Optional, but recommended*)

* Has only been tested with requirejs & browserify

Supported Browsers

Desktop

  • Internet Explorer 9+ (may support IE8**)

  • Google Chrome (tested in version 39.0.2171.95(64-bit))

  • Mozilla Firefox (tested in version 33.0)

  • Opera (tested in version 26.0.1656.60)

  • Safari (tested in version 7.1.2 (9537.85.11.5))

** Have not had a chance to test in IE8, but IE8 is supported by React

Mobile

  • Chrome (tested in version 40.0.2214.89)

  • Safari (tested on iOS 8)

Untested Browsers

  • Internet Explorer 8*** (the lowest version that React supports)

*** If anyone could confirm that this works in IE8, that'd be awesome

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].