0.4.0 • Published 11 months ago

@tackboon/react-grid-rearrange v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

react-grid-rearrange

Rearrange / reorder grid items via drag and drop in react.

ezgif com-gif-maker

View Sandbox Demo

Install

npm i @tackboon/react-grid-rearrange
yarn add @tackboon/react-grid-rearrange

Usage

import { GridContainer, BlockWrapper } from "@tackboon/react-grid-rearrange";

const App = () => {
  return (
    <GridContainer
      totalItem={15}
      itemHeight={100}
      itemWidth={100}
      colGap={10}
      rowGap={20}
    >
      {styles =>
        styles.map((style, i) => {
          return (
            <BlockWrapper index={i} animationStyle={style} key={i}>
              <p>{i}</p>
            </BlockWrapper>
          );
        })
      }
    </GridContainer>
  )
}

Component Properties

GridContainer

PropTypeDescriptionRequired
totalItemNumberSpecify total block items to handletrue
itemHeightNumberDefine block item heighttrue
itemWidthNumberDefine block item widthtrue
rowGapNumberDefine row gap distance in pixelfalse
colGapNumberDefine column gap distance in pixelfalse
disableDragBooleanDisable drag feature (default false)false
disableInitAnimationBooleanDisable initial animation (default false)false
scrollElementIDstringSpecify container ID to scroll (default window)false
cbFunctionReturn callback on actionsfalse

BlockWrapper

PropTypeDescriptionRequired
indexNumberDefine item indextrue
animationStyleObjectPass in animation style from grid containertrue
0.4.0

11 months ago

0.3.2

2 years ago

0.3.3

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago