All Projects → zcued → React Dragline

zcued / React Dragline

Licence: mit
🐼Guide lines and magnetic adsorption to better align draggable elements in React.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Dragline

react-native-dnd-board
A drag and drop Kanban board for React Native.
Stars: ✭ 41 (-69.4%)
Mutual labels:  drag-and-drop, drag, draggable
Vue Smooth Dnd
Vue wrapper components for smooth-dnd
Stars: ✭ 1,121 (+736.57%)
Mutual labels:  drag-and-drop, drag, draggable
Ngx Smooth Dnd
angular wrapper for smooth-dnd
Stars: ✭ 152 (+13.43%)
Mutual labels:  drag-and-drop, drag, draggable
React Smooth Dnd
react wrapper components for smooth-dnd
Stars: ✭ 1,560 (+1064.18%)
Mutual labels:  drag-and-drop, drag, draggable
el-table-draggable
让element-ui的table可拖动排序,支持 行,列,跨表格等特性
Stars: ✭ 68 (-49.25%)
Mutual labels:  drag-and-drop, drag, draggable
Sortable
Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.
Stars: ✭ 23,641 (+17542.54%)
Mutual labels:  drag-and-drop, drag, draggable
Smooth Dnd
drag and drop library for javascript
Stars: ✭ 408 (+204.48%)
Mutual labels:  drag-and-drop, drag, draggable
Dnd Kit
A modern, lightweight, performant, accessible and extensible drag & drop toolkit for React.
Stars: ✭ 3,456 (+2479.1%)
Mutual labels:  draggable, drag-and-drop, drag
Angular Draggable Mat Tree
Example implementation of drag and drop on Angular Material Tree
Stars: ✭ 47 (-64.93%)
Mutual labels:  drag-and-drop, draggable
Jquery Sortablejs
A jQuery binding for SortableJS
Stars: ✭ 94 (-29.85%)
Mutual labels:  drag-and-drop, draggable
Flutter remote control
flutter remote control
Stars: ✭ 124 (-7.46%)
Mutual labels:  drag-and-drop, draggable
Vue Drag Resize
Vue Component for resize and drag elements
Stars: ✭ 1,007 (+651.49%)
Mutual labels:  drag, draggable
Gridstrap.js
gridstrap.js is a jQuery plugin designed to take Bootstrap's CSS grid system and turn it into a managed draggable and resizeable grid while truely maintaining its responsive behaviour.
Stars: ✭ 32 (-76.12%)
Mutual labels:  drag, draggable
Silex
Silex is a static website builder in the cloud.
Stars: ✭ 958 (+614.93%)
Mutual labels:  drag-and-drop, drag
Lean Mean Drag And Drop
Drag&Drop Sorting and Reordering script for complex nested structures
Stars: ✭ 107 (-20.15%)
Mutual labels:  drag-and-drop, draggable
Html5sortable
VanillaJS sortable lists and grids using native HTML5 drag and drop API.
Stars: ✭ 1,384 (+932.84%)
Mutual labels:  drag-and-drop, drag
Ng2 Dnd
Angular 2 Drag-and-Drop without dependencies
Stars: ✭ 861 (+542.54%)
Mutual labels:  drag-and-drop, drag
Muuri
Infinite responsive, sortable, filterable and draggable layouts
Stars: ✭ 9,797 (+7211.19%)
Mutual labels:  drag-and-drop, draggable
React File Drop
React component for Gmail or Facebook -like drag and drop file uploader
Stars: ✭ 123 (-8.21%)
Mutual labels:  drag-and-drop, drag
The Drag And Drop Component Suite For Delphi
Stars: ✭ 109 (-18.66%)
Mutual labels:  drag-and-drop, drag

react-dragline

Guide lines and magnetic adsorption to better align draggable elements.

npm version npm downloads license

Examples available here: https://zcued.github.io/react-dragline/

Installation

npm

npm install react-dragline --save

yarn

yarn add install react-dragline

If you aren't using browserify/webpack, a UMD version of react-dragline is available. It expects external React and ReactDOM.

Example

import { DraggableContainer, DraggableChild } from 'react-dragline'


class Example extends React.Component {
  state = [
    { id: 1, position: {x: 100, y: 10} },
    { id: 2, position: {x: 400, y: 200} },
  ]

  render() {
    const containerStyle = {
      height: 600,
      position: 'relative',
    }

    return (
      <DraggableContainer style={containerStyle}>
        {
          this.state.children.map(({ id, position }, index) => {
            const style = {
              width: 100,
              height: 100,
              cursor: 'move',
              background: '#8ce8df',
            }

            return (
              <DraggableChild key={id} defaultPosition={position}>
                <div style={style} />
              </DraggableChild>
            )
          })
        }
      </DraggableContainer>
    )
  }
}

ReactDOM.render(<Example />, container)

Prop Types

Property Type Default Description
Container String/Element 'div' The DraggableContainer will be rendered as a HTML tag or the React Component you specify
threshold Number 5 The max distance of between others and the dragging element triggering magnetic adsorption
directions Array ['tt', 'bb', 'll', 'rr', 'tb', 'lr' ] The directions you want. tt indicate the guide line will show when a element aligned with the top of the dragging element.
activeClassName String 'active' if you want to add class name for the element aligned with one you drag, use it.
lineStyle Object {} You can customize the style of auxiliary line by this option
limit String true Whether to restricts movement within the container

Contributing

  1. Fork, then clone the project.
  2. Run the project in development mode: $ yarn start.
  3. Make your changes.
  4. Lint the code: $ yarn lint
  5. Make sure that the tests still pass:$ yarn test
  6. Commit and PR.
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].