1.0.1 • Published 9 months ago

react-draggable-masonry v1.0.1

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

React-Draggable-Masonry

An open source library to provider a draggable masonry layout for your react projects, the layout is implmented by CSS and the lib is lightweight, only dependent on react.

Demo

Check here

Install

npm install --save react-draggable-masonry

Usage

Check the file under demo folder

API

Wall

PropTypeDescription
columnWidthnumber | stringwidth of a brick
rowHeightnumber | stringheight of a brick
gapnumber | stringspace between brick
allowDragInSpacebooleanallow brick to drag into this wall
dragMode"normal" | "adapt"the way to manage the brick size while drag and drop:normal: keep the source sizeadapt: resize to target size
swapMode"internal" | "external"the way to manage the bricker order:internal: swap bricks with DOM operationexternal: leave the DOM management to React
childrenreactNodeany react component

Concrete

usually you don't need to use this component

PropTypeDescription
idstringunique id for the brick children
indexnumberbricker order index in wall
childrenBrickBricker component

Brick

Inherit all props from HTMLDIVElement and also have following props additional

PropTypeDescription
draggablebooleanenable/disable drag function on brick
widthnumberhow many cells in row will filled by this brick
heightnumberhow many cells in columns will filled by this brick
allowToSwapbooleanset to false if you want a fixed brick, otherwise if a draggable birck move on this brick, it will swap the position with that one
childrenreactNodeany react component
1.0.1

9 months ago

0.1.12

1 year ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.8

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago