Skip to content
Interactive

DragGrid

Pick up a tile and the others slide out of its way. Works by mouse and touch, and by keyboard: Space lifts a tile, arrows move it, Space drops it.

Download
  • React
  • Tailwind CSS v4
  • motion

Props

NameTypeDefaultWhat it does
itemsDragGridItem[]โ€”Tiles in order: id, label and content. Content must not hold links or buttons, the whole tile is the handle.
onChange(items) => voidโ€”Called with the new order. Store it and pass it back as items.
minSizenumber96Smallest tile width in pixels. The grid fits as many columns as it can.
gapnumber12Space between tiles in pixels.
accentstring"#a78bfa"Ring colour on the tile being moved.
labelstring"Sortable tiles"Read by screen readers.
classNamestringglass square tileReplaces the tile look.