All Projects → bmcmahen → react-grid-dnd

bmcmahen / react-grid-dnd

Licence: other
drag and drop, grid edition. built with react

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-grid-dnd

React Sortable Hoc
A set of higher-order components to turn any list into an animated, accessible and touch-friendly sortable list✌️
Stars: ✭ 9,747 (+5954.04%)
Mutual labels:  grid, drag-and-drop
Vue Grid Layout
A draggable and resizable grid layout, for Vue.js.
Stars: ✭ 5,170 (+3111.18%)
Mutual labels:  grid, drag-and-drop
Dragact
a dragger layout system with React style .
Stars: ✭ 710 (+340.99%)
Mutual labels:  grid, drag-and-drop
Muuri
Infinite responsive, sortable, filterable and draggable layouts
Stars: ✭ 9,797 (+5985.09%)
Mutual labels:  grid, drag-and-drop
The Grid
Grid layout custom element with drag and drop capabilities
Stars: ✭ 122 (-24.22%)
Mutual labels:  grid, drag-and-drop
Muuri React
The layout engine for React
Stars: ✭ 163 (+1.24%)
Mutual labels:  grid, drag-and-drop
Angular Grid Layout
Responsive grid with draggable and resizable items for Angular applications.
Stars: ✭ 163 (+1.24%)
Mutual labels:  grid, drag-and-drop
React Grid Layout
A draggable and resizable grid layout with responsive breakpoints, for React.
Stars: ✭ 14,732 (+9050.31%)
Mutual labels:  grid, drag-and-drop
BeeGridTable
BeeGridTable , is a Highly Customizable Table UI component library based on Vue.js. Rich functions、More efficient、Easy to use!
Stars: ✭ 45 (-72.05%)
Mutual labels:  grid
cyclejs-sortable
Makes all children of a selected component sortable
Stars: ✭ 16 (-90.06%)
Mutual labels:  drag-and-drop
TeeGrid-VCL-FMX-Samples
Grid control for Delphi and C++ (VCL and FMX)
Stars: ✭ 132 (-18.01%)
Mutual labels:  grid
reactablejs
A react high-order component for interact.js(drag and drop, resizing and multi-touch gestures).
Stars: ✭ 59 (-63.35%)
Mutual labels:  drag-and-drop
Tkinter-Designer
An easy and fast way to create a Python GUI 🐍
Stars: ✭ 4,697 (+2817.39%)
Mutual labels:  drag-and-drop
Dsure
Dsure Front-end Development Framework ( Ultimate Personal Learning Edition 2014 )
Stars: ✭ 14 (-91.3%)
Mutual labels:  grid
ngx-widget-grid
Angular 2.x or in general ng-x module for dashboards
Stars: ✭ 65 (-59.63%)
Mutual labels:  grid
GlitchyGrid
An experimental grid layout slideshow with a stack-like navigation and glitch effect.
Stars: ✭ 33 (-79.5%)
Mutual labels:  grid
easy-drag
easy to realize drag and drop effect
Stars: ✭ 34 (-78.88%)
Mutual labels:  drag-and-drop
gpt
A Python toolkit for lattice field theory, quantum computing, and machine learning
Stars: ✭ 60 (-62.73%)
Mutual labels:  grid
react-drag-list
A simple draggable list component。
Stars: ✭ 30 (-81.37%)
Mutual labels:  drag-and-drop
vue-drag-zone
Drag Zone component for @vuejs
Stars: ✭ 127 (-21.12%)
Mutual labels:  drag-and-drop
A demo showing views being swiped left and right.

react-grid-dnd

npm package Follow on Twitter

Grid style drag and drop, built with React. See a live example on codesandbox. You can also see it in action here.

Features

  • Supports dragging between arbitrary number of lists.
  • Built with react-gesture-responder to enable better control over gesture delegation.
  • Disable drop targets or dragging altogether
  • Animated with react-spring

Install

Install react-grid-dnd and react-gesture-responder using yarn or npm.

yarn add react-grid-dnd react-gesture-responder

Usage

Because GridItem components are rendered with absolute positioning, you need to ensure that GridDropZone has a specified height or flex, like in the example below.

import {
  GridContextProvider,
  GridDropZone,
  GridItem,
  swap
} from "react-grid-dnd";

function Example() {
  const [items, setItems] = React.useState([1, 2, 3, 4]); // supply your own state

  // target id will only be set if dragging from one dropzone to another.
  function onChange(sourceId, sourceIndex, targetIndex, targetId) {
    const nextState = swap(items, sourceIndex, targetIndex);
    setItems(nextState);
  }

  return (
    <GridContextProvider onChange={onChange}>
      <GridDropZone
        id="items"
        boxesPerRow={4}
        rowHeight={100}
        style={{ height: "400px" }}
      >
        {items.map(item => (
          <GridItem key={item}>
            <div
              style={{
                width: "100%",
                height: "100%"
              }}
            >
              {item}
            </div>
          </GridItem>
        ))}
      </GridDropZone>
    </GridContextProvider>
  );
}

Dragging between lists

You can see this example in action on codesandbox.

import {
  GridContextProvider,
  GridDropZone,
  GridItem,
  swap,
  move
} from "react-grid-dnd";

function App() {
  const [items, setItems] = React.useState({
    left: [
      { id: 1, name: "ben" },
      { id: 2, name: "joe" },
      { id: 3, name: "jason" },
      { id: 4, name: "chris" },
      { id: 5, name: "heather" },
      { id: 6, name: "Richard" }
    ],
    right: [
      { id: 7, name: "george" },
      { id: 8, name: "rupert" },
      { id: 9, name: "alice" },
      { id: 10, name: "katherine" },
      { id: 11, name: "pam" },
      { id: 12, name: "katie" }
    ]
  });

  function onChange(sourceId, sourceIndex, targetIndex, targetId) {
    if (targetId) {
      const result = move(
        items[sourceId],
        items[targetId],
        sourceIndex,
        targetIndex
      );
      return setItems({
        ...items,
        [sourceId]: result[0],
        [targetId]: result[1]
      });
    }

    const result = swap(items[sourceId], sourceIndex, targetIndex);
    return setItems({
      ...items,
      [sourceId]: result
    });
  }

  return (
    <GridContextProvider onChange={onChange}>
      <div className="container">
        <GridDropZone
          className="dropzone left"
          id="left"
          boxesPerRow={4}
          rowHeight={70}
        >
          {items.left.map(item => (
            <GridItem key={item.name}>
              <div className="grid-item">
                <div className="grid-item-content">
                  {item.name[0].toUpperCase()}
                </div>
              </div>
            </GridItem>
          ))}
        </GridDropZone>
        <GridDropZone
          className="dropzone right"
          id="right"
          boxesPerRow={4}
          rowHeight={70}
        >
          {items.right.map(item => (
            <GridItem key={item.name}>
              <div className="grid-item">
                <div className="grid-item-content">
                  {item.name[0].toUpperCase()}
                </div>
              </div>
            </GridItem>
          ))}
        </GridDropZone>
      </div>
    </GridContextProvider>
  );
}
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].