🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

dragrid

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dragrid

Simple grid with dragging feature for React

0.0.1-alpha.5
latest
Version published
Weekly downloads
8
Maintainers
1
Weekly downloads
 
Created

Logo of Dragrid

Dragrid

Simple grid with dragging feature for React

Demonstration of dragrid

Install

using yarn:

yarn add dragrid

using npm:

npm install dragrid

Usage

import React, { Component } from 'react'
import { Grid } from 'dragrid'

class Example extends Component {
  state = {
    data: [1, 2, 3, 4, 5, 6],
  }

  render() {
    return (
      <Grid
        elements={this.state.data}
        renderElement={(element => <div>{element}</div>)}
        onDrop={(elementIndex, targetIndex) => {
          const copy = [...this.state.data]
          const element = copy.splice(elementIndex, 1)
          copy.splice(targetIndex, 0, element)
          this.setState({ data: copy })
        }}
      />
    )
  }
}

Dragrid uses storybook for development purpose you can also check out stories for a more concrete example.

npm install
npm run storybook

FAQs

Package last updated on 01 Apr 2019

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