AsterUIDocsv1.0.2

Docs / Component reference

TreeView

Open a branch to inspect a hierarchy without flattening it into a single list.

Tree view example

Install

sh
npx @fierst/ui@1.0.2 add tree-view

Registry dependencies: theme, icon. Package dependencies: @lucide/icons.

Exports from ./ui/tree-view: TreeNode, TreeView.

Download the registry source for tree-view 1.0.2.

API contracts

ts
export interface TreeNode {
  id: string;
  label: string;
  children?: readonly TreeNode[];
}

export function* TreeView(
  props: {
    nodes: readonly TreeNode[];
    label?: string;
    defaultExpanded?: readonly string[];
    selectedId?: string;
    onSelect?: (node: TreeNode) => void;
    class?: string;
  },
  ctx: Ctx,
)