Tree View
Data-driven, accessible hierarchy with keyboard navigation.
Import
tsx
import { TreeView } from "@cooud-ui/ui";
bash
npx cooud-ui add tree-view
Examples
API Reference
Generated from the component's exported types.
TreeViewProps
Extends Omit<HTMLAttributes<HTMLDivElement>, "onChange">
| Prop | Type | Default | Description |
|---|---|---|---|
data* | TreeNode[] | — | The hierarchy to render. |
value | string | — | Controlled selected node id. |
defaultValue | string | — | Initial selected node id for the uncontrolled case. |
onValueChange | (id: string) => void | — | Called when the selection changes (controlled or not). |
expandedIds | string[] | — | Controlled set of expanded branch ids. |
defaultExpandedIds | string[] | — | Initial expanded branch ids for the uncontrolled case. |
onExpandedChange | (ids: string[]) => void | — | Called whenever the expanded set changes (controlled or not). |
aria-label | string | — | Accessible label for the tree landmark. |