"use client";
import { TreeSelect } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
items (required) | readonly TreeItem[] | — | Items to render. |
defaultOpen | boolean | — | Initial open state when uncontrolled. |
defaultValue | string | — | Initial value when uncontrolled. |
onOpenChange | (open: boolean) => void | — | Called with the next open state. |
onValueChange | (value: string) => void | — | Called with the new value (only when it changes). |
open | boolean | — | Open state (controlled). |
placeholder | string | — | — |
value | string | — | Current value (controlled); null where it means "nothing selected". |
itemsrequiredreadonly TreeItem[]
Items to render.
defaultOpenboolean
Initial open state when uncontrolled.
defaultValuestring
Initial value when uncontrolled.
onOpenChange(open: boolean) => void
Called with the next open state.
onValueChange(value: string) => void
Called with the new value (only when it changes).
openboolean
Open state (controlled).
placeholderstring
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" },
];
<TreeSelect items={items} />