TreeSelect

A tree-based dropdown selector for hierarchical data.

When to Use

  • For selecting from a tree structure (departments, categories)
  • When options have parent-child relationships
  • As an alternative to Cascader with a tree view

Import

import { TreeSelect } from "orizon";

Examples

Basic

<TreeSelect
  treeData={[
    {
      title: "Engineering",
      value: "engineering",
      children: [
        { title: "Frontend", value: "frontend" },
        { title: "Backend", value: "backend" },
      ],
    },
  ]}
  placeholder="Select department"
  onChange={(value) => console.log(value)}
/>

Multiple with Checkboxes

<TreeSelect
  treeCheckable
  multiple
  treeData={treeData}
  placeholder="Select teams"
  style={{ width: 300 }}
/>

Searchable

<TreeSelect showSearch treeData={treeData} placeholder="Search..." />

API

TreeSelectProps

  • treeDataTreeNode[] — Tree option data
  • valuestring | string[] — Selected value(s) (controlled)
  • defaultValuestring | string[] — Default value
  • onChange(value, label, extra) => void — Selection handler
  • multipleboolean — Allow multiple selections (default: false)
  • treeCheckableboolean — Show checkboxes (default: false)
  • showSearchboolean — Enable search (default: false)
  • treeDefaultExpandAllboolean — Expand all nodes (default: false)
  • loadData(node) => Promise — Async data loading
  • fieldNames{ label, value, children } — Custom field mapping
  • placeholderstring — Placeholder text
  • disabledboolean — Disable the selector
  • size"small" | "middle" | "large" — Size
  • status"error" | "warning" — Validation status
  • allowClearboolean — Show clear button (default: true)