Skip to content

Tree Select

Free

Pick many values from a tree, such as countries and cities. Branches open in place, a parent shows a dash when partly picked, and search keeps the path.

  • Base UI
  • React Aria
  • React 19
  • Tailwind CSS 4

Added Nov 17, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Pass the tree as items. Each node has a value, a label, and optional children. The value is always a string[].

category-picker.tsx

TreeSelect

<div>
PropTypeDefaultDescription
itemsRequired—The tree: each node has value, label, and optional children, count, disabled, disabledReason, hasChildren.
valuereadonly string[]—The picked values. With store="leaves" (default) only leaves; with store="compact" a full branch is its own value ("watches" for all 5 watches), so new children join it.
defaultValuereadonly string[]—
onValueChange—
multiplebooleantruePick many (checkboxes, chips) or one (no boxes, the path in the trigger). Default true.
store"compact""leaves""leaves"How the value names a full branch: each leaf (leaves), or the branch (compact).
getChildren—Loads the rows of a branch with hasChildren and no children, when it opens.
openboolean—
defaultOpenbooleanfalse
onOpenChange—
disabledbooleanfalse
readOnlybooleanfalse
invalidbooleanfalse
namestring—The field name the form sends: one entry per value.
size"default""lg""default"The trigger row: default 32px with 24px chips, lg 36px with 28px chips.
localestring—The search locale. Default: the DisplayLocaleProvider locale, else en-US.
labels—
classNamestring—Classes of the root box (its width).
childrenReactNode—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

TreeSelectTrigger

<div>
PropTypeDefaultDescription
aria-labelstring—Defines a string value that labels the current element. Names the field ("Applies to"): the trigger has no visible label of its own.
aria-labelledbystring—Identifies the element (or elements) that labels the current element.
placeholderstring—The muted text while nothing is picked.
maxChipsnumber3The chips that show before the rest fold into "+N". Default 3.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

TreeSelectContent

<div>
PropTypeDefaultDescription
classNamestring—
arrowboolean—Show an arrow that points at the trigger. The gap grows from 4px to 8px.
backdropboolean—Put a clear layer under the popup (Base UI Popover.Backdrop), for example to dim it.
padding"default""none""tight"—default: radius 14, 12px padding and 10px between the parts, 288px wide. tight: 4px padding and 4px between the parts, as wide as the content: a row of 28px actions (a plain Toolbar) with the 4px inset of the bar recipe, 38px high (the selection pill of the Quote Reply). none: no padding and no gap, as wide as the content: a panel that lays out its own parts edge to edge (a head with a rule, a scroll box, a docked composer: the Chat Popup). Give it a width and a height with layout classes; the body fills that height.
portalProps—Other Base UI props of the inner parts. A className here adds to the component classes.
positionerProps—
backdropPropsPopupPartProps<PopoverBackdropProps>—
arrowPropsPopupPartProps<PopoverArrowProps>—
closeButtonProps—
From Base UIPopover.PortalBase UI docs
anchor—An element to position the popup against. By default, the popup will be positioned against the trigger.
positionMethod"absolute""fixed"'absolute'Determines which CSS position property to use.
side"bottom""inline-end""inline-start""left""right""top"'bottom'Which side of the anchor element to align the popup against. May automatically change to avoid collisions.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

TreeSelectSearch

<input>
PropTypeDefaultDescription
childrenReactNode—Things at the end of the row, after the clear button: TreeSelectExpandAll.
...props<input> attributes—Every other attribute goes to the <input>, with a ref.

TreeSelectExpandAll

<button>
PropTypeDefaultDescription
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
glass"clear""dark""light"—
rounded"default""full"—
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

TreeSelectTree

PropTypeDefaultDescription
aria-labelstring—Names the tree ("Categories").
classNamestring—
renderIcon—A mark before a row label: an icon per node (a folder, a flag).

TreeSelectFooter

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

TreeSelectCount

<span>
PropTypeDefaultDescription
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

TreeSelectClear

<button>
PropTypeDefaultDescription
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
glass"clear""dark""light"—
rounded"default""full"—
size"default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs"—
variant"dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary"—
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

TreeSelectDone

<button>
PropTypeDefaultDescription
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
glass"clear""dark""light"—
rounded"default""full"—
size"default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs"—
variant"dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary"—
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.
  • Use it when the options form a tree and people pick many leaves, or whole branches at once.
  • Use store="compact" to save a full branch as one value, so new children join the pick.
  • Use multiple={false} to pick one leaf: the field then shows its path, such as Audio / Turntables.
  • Use getChildren to load the rows of a branch when it opens.
  • To pick a value one level at a time, or in columns, use a Cascader.
  • For a flat list with search, use a Combobox.
  • For a tree that stays open on the page, use a Tree.
  • To move many items between two lists, use a Transfer List.
EnterorSpaceOn the field, opens the popup. Focus goes to the search.
Down ArrowIn the search, moves focus to the first row of the tree.
Up ArroworDown ArrowMoves between the rows. A disabled row is skipped.
Right ArroworLeft ArrowOpens or closes the branch of the row. Right to left swaps them.
SpaceChecks or clears the row. On a parent, it checks or clears every leaf under it.
BackspaceIn an empty search, removes the last pick.
EscapeIn the search, clears the text first. Then it closes the popup, and focus goes back to the field.
TabFrom the field, moves to the chips. Left Arrow and Right Arrow move between them.
DeleteorBackspaceOn a chip, removes the pick. A branch chip removes every leaf under it.

The field is a button that opens a dialog popup. The options are a tree grid with checkboxes, from React Aria.

A parent with some picks shows a dash (mixed), and with all picks a check.

A disabled row says why at its end, and the arrow keys skip it.

On a touch screen the rows are 44px high, and the search does not take focus, so no keyboard opens.

Open
popup · 150ms · ease-panel (0.2, 0.4, 0.2, 1) · fades in and scales from 95%
Close
popup-exit · 120ms · ease-out (0, 0, 0.2, 1)
Chevron
panelBounce · the field chevron turns past its angle while the popup opens, then settles

Built with

Installs with Tree Select

  1. AddedTree Select, with Button, Collapsible, Highlight, Popover, Tag Group, Tree.
Open the release