Skip to content
Alea0.1

Forms

TreeSelect

A select whose options are a tree, single or multiple.

Ant Design: TreeSelect

import { TreeSelect } from '@alea/ui';

Examples

TreeSelect

Single or multiple choice from a tree.

Featured
Show in the menu

Props

TreeSelect props

A select whose options are a tree: categories, folders, org charts (Ant's TreeSelect).

PropTypeDefaultDescription
nodesrequiredTreeNode[]-The tree: id, label, children.
defaultValueKey[]-The selected id to start with.
isDisabledboolean-Disables every part of it.
labelReactNode-The visible label.
onChange((keys: Key[]) => void)-Called with the selected id.
placeholderstring'Select…'Shown while there is no value.
selectionMode"single" | "multiple"'single'single (default) or multiple.
valueKey[]-The selected id (controlled).

Accessibility

  • The options are a tree grid: arrows open and close branches.

Keyboard

KeyDoes
Enter or SpaceOpens the tree
Arrow keysMove; Right expands, Left collapses
EnterPicks the item
EscapeCloses

Do and don't

Do

  • Use it to pick a folder or category from a tree.
  • Expand the path to the current value when it opens.

Don't

  • Don't use it for flat lists: use Select.
  • Don't hide the selected item's parents.
Tested with axe, keyboard and screen reader roles