Blokd UIDocsv1.1.0

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/blokd-ui@1.1.0 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.1.0.

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,
)