Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Tree Select

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

tree-select.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/tree-select.json

It 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.

Its preview and code are at the top of the page.

The trigger and the popup are Select's, and Clear takes Button's ghost variant with an X named "Clear". A row that matches the filter is drawn in a heavier weight. This item takes Base UI's component ID as its slug and one name per Base UI part.

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.