Skip to Content
snapgrid is a react-grid-layout v2 alternative built on dnd-kit. Drag, resize, repack, and drag between grids.

Examples

Every demo below is the real library running in your browser: drag, resize, and play. Each links to the guide that explains it.

Drag & resize

The basics: drag a tile, resize it from the corner, watch the rest compact upward. → Getting Started

Drag & resize
drag a tile · resize from the corner

Compaction & packing

Swap the packing algorithm at runtime: vertical, horizontal, masonry, gravity, shelf, or free. → Compaction guide

Compaction
swap the packing algorithm, then drag

Resize constraints

Every edge and corner, with per-item minW / maxW / minH / maxH enforced. → Resizing guide

Resize constraints
every edge & corner · min/max enforced

Drag handles

Drag only by the grip; the rest of the tile stays interactive. → Dragging guide

Drag handle
only the ⠿ grip starts a drag — the button stays clickable

Snap to grid

Toggle whether the dragged tile glides with the pointer or snaps to cells. → Dragging guide

Snap to grid
toggle whether the dragged tile snaps or glides

Static items

Pin a tile so it never moves while others flow around it. → Static items guide

Static items
the hatched tile is pinned — others flow around it

Responsive

Columns and layout change as the width crosses breakpoints. → Responsive guide

Responsive
12 columns · 560px — drag the right edge to resize

Cross-grid dragging

Two grids in a SnapGridGroup. Drag tiles between them. → Cross-grid guide

Cross-grid dragging
drag a tile between the two grids

Nested grids

A grid inside another grid’s tile. Drag the panel by its header, or rearrange the inner tiles. → Nesting guide

Nested grids
drag the panel by its header; drag the inner tiles freely

External drop

Drag a chip from a palette into the grid; the grid synthesizes a new item. → External drop guide

External drop
drag a chip from the palette into the grid

Headless

The same engine with entirely custom markup, via SnapGridProvider + hooks. → Headless guide

Headless
your own markup via SnapGridProvider + hooks
Last updated on