Troubleshooting
Fix common setup issues.
The grid is empty or items do not render
- Ensure every child
keymatches a layout itemid. - Ensure the grid container has a non-zero width (block-level or explicit size).
- Make sure each layout item has
wandhgreater than 0.
Dragging or resizing does not work
- Check
draggableandresizableon the grid and items. static: truedisables drag and resize.- Make sure
dragHandleanddragCancelselectors match your DOM.
Resize handles are missing
- Import
@dnd-grid/react/styles.css. - Verify
resizeHandlesis not empty and the item is resizable.
Layout jumps on hydration
- Keep
measureBeforeMountenabled (default) to wait for measurement. - If you render early, set
initialWidthto an expected container width. - Pass
widthdirectly when you already know the width.
Auto-scroll does not trigger
- Ensure the scroll container has
overflow: autoorscroll. - Pass
autoScrolloptions to adjustthresholdandactivator. - Use
AutoScrollActivator.DraggableRectif pointer coordinates are unreliable.
Items overlap unexpectedly
- Use a non-overlap compactor like
verticalCompactororhorizontalCompactor. - Avoid
allowOverlapvariants unless you want stacking. - Set
preventCollisionif you want drag moves to be blocked.