"use client";
import { TableTree } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
items (required) | readonly Item[] | — | Items to render. |
columns | readonly TableTreeColumn<Item>[] | — | Columns after the tree (name) column; a header row is rendered with them. |
defaultExpandedValue | readonly string[] | — | — |
defaultValue | string | — | Initial value when uncontrolled. |
expandedValue | readonly string[] | — | — |
header | ReactNode | from messages: "Name" | Header of the tree column (default from messages: "Name"). |
onAction | (id: string) => void | — | Called on every activation (click, Enter, Space), also of the selected item. |
onExpandedValueChange | (value: string[]) => void | — | — |
onValueChange | (value: string) => void | — | Called with the new value (only when it changes). |
value | string | — | Current value (controlled); null where it means "nothing selected". |
itemsrequiredreadonly Item[]
Items to render.
columnsreadonly TableTreeColumn<Item>[]
Columns after the tree (name) column; a header row is rendered with them.
defaultExpandedValuereadonly string[]
defaultValuestring
Initial value when uncontrolled.
expandedValuereadonly string[]
headerdefault from messages: "Name"ReactNode
Header of the tree column (default from messages: "Name").
onAction(id: string) => void
Called on every activation (click, Enter, Space), also of the selected item.
onExpandedValueChange(value: string[]) => void
onValueChange(value: string) => void
Called with the new value (only when it changes).
valuestring
Current value (controlled); null where it means "nothing selected".
const items = [
{ id: "assets", label: "Assets", children: [{ id: "images", label: "Images" }] },
{ id: "exports", label: "Exports" },
];
<TableTree aria-label="Files" columns={[{ id: "kind", header: "Kind", cell: (item) => (item.children?.length ? `${item.children.length} items` : "File") }]} items={items} />