Skip to main content

Treegrid

Hierarchical grid combining tree and grid patterns.

Usage

<w-treegrid label="File browser">
<w-slot row data-level="1" expandable>
<div>
<w-slot cell><div>Documents</div></w-slot>
<w-slot cell><div>Folder</div></w-slot>
</div>
</w-slot>
<w-slot row data-level="2">
<div>
<w-slot cell><div>Report.pdf</div></w-slot>
<w-slot cell><div>File</div></w-slot>
</div>
</w-slot>
</w-treegrid>

Props

PropTypeDefaultDescription
labelstring""Accessible label

Slots

SlotElementDescription
rowContainerGrid row (use data-level, expandable attributes)
cellAnyGrid cell

Row Attributes

AttributeDescription
data-levelNesting level (1, 2, 3, etc.)
expandableRow can be expanded

Keyboard

KeyAction
ArrowRightExpand row or move right
ArrowLeftCollapse row or move left
ArrowDownNext visible row
ArrowUpPrevious visible row

Accessibility

  • Combines role="treegrid" with tree navigation
  • Rows have aria-expanded when expandable
  • aria-level indicates depth