Skip to content

Commit 30ac650

Browse files
committed
1 parent 89bf059 commit 30ac650

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,20 @@ will be draggable, even if the item is marked `static: true`.
511511
}
512512
```
513513
514+
### Grid Item Heights and Widths
515+
516+
Grid item widths are based on container and number of columns. The size of a grid unit's height is based on `rowHeight`.
517+
518+
Note that an item that has `h=2` is *not exactly twice as tall as one with `h=1` unless you have no `margin`*!
519+
520+
In order for the grid to not be ragged, when an item spans grid units, it must also span margins. So you must add the height or width or the margin you are spanning for each unit. So actual pixel height is `(rowHeight * h) + (marginH * (h - 1)`.
521+
522+
For example, with `rowHeight=30`, `margin=[10,10]` and a unit with height 4, the calculation is `(30 * 4) + (10 * 3)`
523+
524+
![margin](margin.png)
525+
526+
If this is a problem for you, set `margin=[0,0]` and handle visual spacing between your elements inside the elements' content.
527+
514528
### Performance
515529
516530
`<ReactGridLayout>` has [an optimized `shouldComponentUpdate` implementation](lib/ReactGridLayout.jsx), but it relies on the user memoizing the `children` array:

margin.png

53.4 KB
Loading

0 commit comments

Comments
 (0)