Skip to main content

Grid

Interactive data grid with keyboard navigation.

Usage

<w-grid label="Data table">
<w-slot row>
<div>
<w-slot cell><div>A1</div></w-slot>
<w-slot cell><div>B1</div></w-slot>
<w-slot cell><div>C1</div></w-slot>
</div>
</w-slot>
<w-slot row>
<div>
<w-slot cell><div>A2</div></w-slot>
<w-slot cell><div>B2</div></w-slot>
<w-slot cell><div>C2</div></w-slot>
</div>
</w-slot>
</w-grid>

Props

PropTypeDefaultDescription
labelstring""Accessible label

Slots

SlotElementDescription
rowContainerGrid row
cellAnyGrid cell
rowheaderAnyRow header cell

Keyboard

KeyAction
ArrowRightNext cell
ArrowLeftPrevious cell
ArrowDownCell below
ArrowUpCell above
HomeFirst cell in row
EndLast cell in row
Ctrl+HomeFirst cell in grid
Ctrl+EndLast cell in grid

Accessibility

  • Container has role="grid"
  • Rows have role="row"
  • Cells have role="gridcell" or role="rowheader"
  • Focusable cells with roving tabindex