Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-tree-table>

@methane-ui/datagrid~11.2 KB brotli shell + lazy engine~3.8 KB shell · lazy engine chunk

Hierarchical expandable tree table wrapping @tanstack/table-core getExpandedRowModel and @tanstack/virtual-core with treegrid keyboard navigation.

When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.

Live Interactive Preview

Interactive StageLive Custom Element · <mth-tree-table> (@methane-ui/datagrid)
Ready · interact with <mth-tree-table>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/datagrid/tree-table"></script>
<mth-tree-table sub-rows-key="children" row-height="38"></mth-tree-table>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
rows—ReadonlyArray<unknown>—Hierarchical tree row records.
columns—ReadonlyArray<unknown>—Column definitions.
subRowsKeysub-rows-keystring"children"Property key holding nested child rows.
expandedIds—ReadonlyArray<string>—Controlled list of expanded row IDs.
selectableselectablebooleanfalseEnables row selection checkboxes.
rowHeightrow-heightnumber38Estimated row height in pixels.
labellabelstring""Accessible treegrid label.

Events

EventDetail TypeDescription
mth-expand-change{ rowId: string; expanded: boolean; expandedIds: ReadonlyArray<string> }Fired when a row branch expands or collapses.
mth-selection-change{ selectedIds: ReadonlyArray<string> }Fired when selected row IDs change.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowDownbothtree row focusedmoves roving focus to next visible row
ArrowUpbothtree row focusedmoves roving focus to previous visible row
ArrowRightbothcollapsed parent row focusedexpands child rows
ArrowLeftbothexpanded parent row focusedcollapses child rows
Homebothtree row focusedmoves roving focus to first row
Endbothtree row focusedmoves roving focus to last row

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="host".lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 6 APG keyboard transitions across LTR/RTL.mth-tree-table.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(empty), :state(selectable).Conformance suite
i18nRoutes 5 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test