← All Components
<mth-tree-table>
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
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>import '@methane-ui/datagrid/tree-table';
import '@methane-ui/react';
export function Example() {
return <mth-tree-table sub-rows-key="children" row-height="38"></mth-tree-table>;
}<script setup lang="ts">
import '@methane-ui/datagrid/tree-table';
</script>
<template>
<mth-tree-table sub-rows-key="children" row-height="38"></mth-tree-table>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/datagrid/tree-table';
import { MthTreeTableDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthTreeTableDirective],
template: `<mth-tree-table sub-rows-key="children" row-height="38"></mth-tree-table>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/datagrid/tree-table';
import MthTreeTable from '@methane-ui/svelte/MthTreeTable.svelte';
</script>
<MthTreeTable sub-rows-key="children" row-height="38"></MthTreeTable>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
rows | — | ReadonlyArray<unknown> | — | Hierarchical tree row records. |
columns | — | ReadonlyArray<unknown> | — | Column definitions. |
subRowsKey | sub-rows-key | string | "children" | Property key holding nested child rows. |
expandedIds | — | ReadonlyArray<string> | — | Controlled list of expanded row IDs. |
selectable | selectable | boolean | false | Enables row selection checkboxes. |
rowHeight | row-height | number | 38 | Estimated row height in pixels. |
label | label | string | "" | Accessible treegrid label. |
Events
| Event | Detail Type | Description |
|---|---|---|
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
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowDown | both | tree row focused | moves roving focus to next visible row |
| ArrowUp | both | tree row focused | moves roving focus to previous visible row |
| ArrowRight | both | collapsed parent row focused | expands child rows |
| ArrowLeft | both | expanded parent row focused | collapses child rows |
| Home | both | tree row focused | moves roving focus to first row |
| End | both | tree row focused | moves roving focus to last row |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="host". | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 6 APG keyboard transitions across LTR/RTL. | mth-tree-table.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(empty), :state(selectable). | Conformance suite |
| i18n | Routes 5 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |