Documentation
Concepts

State attributes

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

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

Parts

Every part carries data-grid-part: root, grid, header, header-row, header-cell, body, row or cell. Rows and cells carry their indexes: data-row-index (the header row is -1) and data-column-index. Tests select by them, never by class names.

States

attributeonwhen
data-activecell, header cellit is the active cell
data-activerowit holds the active cell
data-loadingrow, cellits row is not loaded yet (getRow answered undefined)

ARIA

attributeonvalue
rolegrid, rowgroup, row, columnheader, gridcellthe grid pattern
aria-rowcountgridevery row, header included, rendered or not
aria-colcountgridevery column
aria-rowindexrow1-based, the header row first
aria-colindexcell, header cell1-based

Styling a state

grid.css
[data-grid-part="cell"][data-active] {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

[data-grid-part="row"][data-loading] [data-grid-part="cell"]::after {
    content: "";
    inline-size: 60%;
    block-size: 0.75rem;
    background: var(--placeholder);
}

With Tailwind: data-active:outline-2, data-loading:opacity-50.