Zephora UI

Navigation

TreeSelect

Dropdown select whose options are a hierarchical tree, with expandable branches, full keyboard navigation, and optional multi-select chips, cascading checkboxes, search and a clear button.

Import

import { TreeSelect } from "@zephora/react";

Examples

Basic

Branches expand with the chevron; leaves select and close the popup.

Controlled

`value` + `onValueChange` control the selected key (null clears it).

Selected key: docs

Multiple with checkboxes and search

`checkable` renders cascading checkboxes (checking a branch checks its subtree; partial branches report aria-checked="mixed") and implies multiple values. `searchable` filters nodes, `allowClear` clears everything, and `expandedKeys` can be controlled.

Germany

Values: de

API

TreeSelect props

PropTypeDefaultDescription
data *TreeNode[] — { key: string; label: string; disabled?: boolean; children?: TreeNode[] }Tree of selectable nodes.
valuestring | nullControlled selected key.
defaultValuestring | nullnullInitial selected key when uncontrolled.
onValueChange(value: string | null) => voidCalled with the selected key (or null when deselected).
multiplebooleanfalseAllow selecting multiple keys; the trigger renders removable chips.
checkablebooleanfalseRenders checkboxes on every node. Checking a branch cascades to its descendants; partially-checked branches report aria-checked="mixed". Implies multiple values.
values / defaultValues / onValuesChangestring[] / string[] / (values: string[]) => voidControlled / uncontrolled selected keys in multiple/checkable mode.
searchablebooleanfalseRenders a search input at the top of the popup that filters nodes.
allowClearbooleanfalseShows a clear button in the trigger when something is selected.
maxDisplaynumberCollapses chips beyond this count into "+N" (multiple/checkable mode).
placeholderstring"Select…"Text shown when nothing is selected.
size"sm" | "md" | "lg""md"Trigger size.
invalidbooleanfalseMarks the field invalid.
disabledbooleanfalseDisables the trigger.
expandedKeysstring[]Controlled expanded branch keys.
defaultExpandedKeysstring[]Keys of branches expanded on first render.
onExpandedChange(keys: string[]) => voidCalled with the new expanded keys array whenever expansion changes.
unstyledbooleanfalseHeadless mode — skips Zephora styling.

Keyboard

KeyAction
ArrowDownOn the trigger: opens the popup. In the tree: next node.
ArrowUpPrevious visible node.
ArrowRightExpands a collapsed branch, or moves to its first child.
ArrowLeftCollapses an expanded branch, or moves to the parent.
Home / EndJump to the first / last visible node.
Enter / SpaceSelects a leaf (and closes) or toggles a branch's selection.
EscapeCloses the popup and refocuses the trigger.