Skip to content
Data Display

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">

PropTypeDefaultDescription
data*
TreeNode[]The hierarchy to render.
value
stringControlled selected node id.
defaultValue
stringInitial selected node id for the uncontrolled case.
onValueChange
(id: string) => voidCalled 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[]) => voidCalled whenever the expanded set changes (controlled or not).
aria-label
stringAccessible label for the tree landmark.