Documentation
Concepts

State attributes

Every state a part has is a data attribute, present or absent, so any styling solution can read it.

A part's state is on its element as data-* attributes. A boolean attribute is present (empty) or absent, never "false".

Parts

Every part carries data-grid-layout-part: root, item, drag-handle, resize-handle, placeholder, drag-source, drag-preview or cell. Items carry data-item-id. Tests select by them, never by class names.

States

attributeonwhen
data-draggingroot, item, drag handlea pointer is moving the item
data-resizingroot, item, resize handlea pointer is resizing the item (from this handle)
data-grabbedroot, item, drag handlethe keyboard holds the item
data-droppingroota new item from outside is over the grid
data-drop-refusedroot, drag previewan external drag over the grid would not drop
data-outsideroot, itemthe pointer holding an item, or bringing one, is off the grid
data-draggingdrag sourcea pointer is bringing its item in
data-grabbeddrag sourcethe keyboard is bringing its item in
data-disableddrag sourceit starts nothing
data-overdrag previewthe pointer is over the grid
data-pressingitema touch holds it, not yet long enough to drag it
data-staticitemthe item never moves
data-draggableitem, drag handlepeople may drag the item now
data-resizableitempeople may resize the item now
data-sideresize handleits side: top, bottom, start, end or a corner
data-breakpointrootthe active breakpoint's name
data-kindplaceholdermove, resize, keyboard or drop
data-x, data-ycellits column and row

From state functions

className and style also take a function of the part's state, which holds the same and more: itemId, item (its place and size), placed and handled on an item.

card.tsx
<GridLayout.Item
    itemId={item.id}
    className={(state) => (state.dragging ? "card card-lifted" : "card")}
/>
Styling showcase
Gallery