"use client";
import { TreeView } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
items (required) | readonly DataTreeItem[] | — | Items to render. |
defaultExpandedValue | readonly string[] | — | — |
defaultValue | string | — | Initial value when uncontrolled. |
expandedValue | readonly string[] | — | — |
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 DataTreeItem[]
Items to render.
defaultExpandedValuereadonly string[]
defaultValuestring
Initial value when uncontrolled.
expandedValuereadonly string[]
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".
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
const items = [
{ id: "assets", label: "Assets", children: [{ id: "images", label: "Images" }] },
{ id: "exports", label: "Exports" },
];
<TreeView aria-label="Files" items={items} />