Skip to content

TreeSelect

Pick one node from a collapsible tree inside a popup. Branches expand and collapse like a tree view; picking a node shows its label on the trigger and stores the value in a hidden input.

Example

<TreeSelect
  id="team"
  label="Team"
  name="team"
  options={[
    { value: "engineering", label: "Engineering", children: [
      { value: "ada", label: "Ada Lovelace" },
      { value: "grace", label: "Grace Hopper" },
    ] },
    { value: "design", label: "Design" },
  ]}
/>

Preselected node

<TreeSelect
  id="mentor"
  label="Mentor"
  name="mentor"
  options={…}
  value="grace"
/>

Selectable branches

By default only leaves select (selectable="leaf"): activating a branch toggles it. Withselectable="any", branches pick their own value instead.

<TreeSelect
  id="department"
  label="Department"
  name="department"
  options={…}
  selectable="any"
/>

Error state

Choose a reviewer.

<TreeSelect
  id="reviewer"
  label="Reviewer"
  name="reviewer"
  options={…}
  error="Choose a reviewer."
/>

Props

PropTypeDefaultDescription
idstring-Required. Names Field/panel/message ids (trigger itself carries no id).
labelstring-Visible label; kept in the trigger name and panel name.
namestringidHidden-input form name; carries the selected value.
optionsCascadeOption[] ({ value; label; disabled?; children? })-Tree nodes; branches expand, leaves select.
valuestring""Preselected node value; its ancestors open on first open.
selectable"any" | "leaf""leaf"Whether branches select or only toggle.
placeholderstring"Select …"Empty-state trigger text; defaults to the lowercased label.
hintstring-Help text below the trigger.
errorstring-Error message; sets aria-invalid on the trigger.
requiredbooleanfalseMarks the label required.
disabledbooleanfalseNon-interactive; trigger cannot open.
classstring-Style passthrough.

Accessibility