UIComponentsReact
A button that opens a tree in a popup to pick one or more items, with an optional filter.
Built on the headless Tree Select.See its API in Docs
Rendered by React 19.3.1
Installation
npx shadcn@4.23.0 add https://hamur.dev/r/react/tree-select.jsonIt also adds utils, button. The app needs its setup first: Installation.
Usage
Put TreeSelectTrigger (with a TreeSelectValue inside; the chevron comes with it) and an optional TreeSelectClear in TreeSelect, then TreeSelectPortal > TreeSelectPositioner > TreeSelectPopup around an optional TreeSelectInput, the TreeSelectTree and TreeSelectEmpty. The tree's rows are the Tree's parts under this item's names: TreeSelectItem, TreeSelectItemContent, TreeSelectItemToggle, TreeSelectItemIndicator, TreeSelectItemText and TreeSelectGroup. The opening keys, the filter, the selection and the form value come from the headless Tree Select.
import {
TreeSelect,
TreeSelectArrow,
TreeSelectBackdrop,
TreeSelectClear,
TreeSelectEmpty,
TreeSelectGroup,
TreeSelectIcon,
TreeSelectInput,
TreeSelectItem,
TreeSelectItemContent,
TreeSelectItemIndicator,
TreeSelectItemText,
TreeSelectItemToggle,
TreeSelectPopup,
TreeSelectPortal,
TreeSelectPositioner,
TreeSelectStatus,
TreeSelectTree,
TreeSelectTrigger,
TreeSelectValue,
} from '@/components/ui/tree-select'Examples
Default
A folder picker with a filter input and the selected label.
API reference
The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Tree Select's API reference.