Filigran

Tree Select Example

Groups: none

Children: none

How to use this component

A hierarchical multi-select component that displays options in a tree structure with parent/child relationships. Supports search, expand/collapse, and multi-selection with badges.

Props

NameTypeDefaultDescription
options *TreeSelectOption[]-The hierarchical options to display in the tree.
selectedGroupIds *string[]-IDs of the selected parent groups.
selectedChildIds *string[]-IDs of the selected children.
onSelectionChange *(groupIds: string[], childIds: string[]) => void-Callback fired when selection changes.
placeholderstring"Select..."Text displayed when nothing is selected.
searchPlaceholderstring"Search..."Placeholder text for the search input.
emptyMessagestring"No results found."Text displayed when search yields no results.
disabledbooleanfalseWhether the user can interact with the component.
classNamestring-Additional CSS classes for the trigger button.

TreeSelectOption type

type TreeSelectChild = {
  id: string
  text: string
}

type TreeSelectOption = {
  id: string
  text: string
  children?: TreeSelectChild[]
}

Playground

Import from @filigran/ui :

import {TreeSelect} from '@filigran/ui/clients'

Note: This playground shows the component structure. Since TreeSelect is a controlled component requiring useState, the interactive example above demonstrates full functionality.


  <TreeSelect
    options={[
      {
        id: 'fruits',
        text: 'Fruits',
        children: [
          { id: 'apple', text: 'Apple' },
          { id: 'banana', text: 'Banana' },
        ],
      },
      {
        id: 'vegetables',
        text: 'Vegetables',
        children: [
          { id: 'carrot', text: 'Carrot' },
          { id: 'broccoli', text: 'Broccoli' },
        ],
      },
    ]}
    selectedGroupIds={[]}
    selectedChildIds={[]}
    onSelectionChange={(groupIds, childIds) =>
      console.log('Selected:', groupIds, childIds)
    }
    placeholder="Select items..."
  />