Tree

A hierarchical tree structure for displaying and selecting nested data.

When to Use

  • For file system or folder navigation
  • To display organizational hierarchies
  • When users need to select items from a nested structure

Import

import { Tree } from "orizon";

Examples

Basic

Parent Node
Child 1
Child 2
Child 3
<Tree
  defaultExpandedKeys={["parent"]}
  treeData={[
    {
      title: "Parent Node",
      key: "parent",
      children: [
        { title: "Child 1", key: "child-1" },
        { title: "Child 2", key: "child-2" },
      ],
    },
  ]}
/>

Checkable

Documents
report.pdf
notes.txt
image.png
<Tree
  checkable
  treeData={treeData}
  onCheck={(checkedKeys) => console.log(checkedKeys)}
/>

Show Line

Root
Branch A
Branch B
<Tree showLine treeData={treeData} />

API

TreeProps

  • treeDataTreeNode[] — Tree structure data
  • checkableboolean — Show checkboxes (default: false)
  • selectedKeysstring[] — Selected node keys (controlled)
  • checkedKeysstring[] — Checked node keys (controlled)
  • expandedKeysstring[] — Expanded node keys (controlled)
  • defaultExpandedKeysstring[] — Initially expanded keys
  • draggableboolean — Enable drag and drop (default: false)
  • showLineboolean — Show connecting lines (default: false)
  • showIconboolean — Show node icons (default: false)
  • multipleboolean — Allow multi-selection (default: false)
  • checkStrictlyboolean — Disable cascading check (default: false)
  • blockNodeboolean — Full-width clickable nodes (default: false)
  • heightnumber — Virtual scroll height
  • loadData(node) => Promise — Async data loading
  • filterTreeNode(node) => boolean — Filter function

TreeNode

  • titleReactNode — Node display text
  • keystring — Unique identifier
  • childrenTreeNode[] — Child nodes
  • disabledboolean — Disable the node
  • selectableboolean — Whether node is selectable
  • checkableboolean — Override checkable for this node
  • isLeafboolean — Mark as leaf (no expand icon)
  • iconReactNode — Custom icon