TreeSelect <pm-tree-select>
Tree select: choose from a hierarchy shown as an expandable tree in a dropdown (folders, departments, categories).
Sizes
Set with the size attribute; controls keep touch-sized targets on phones.
size="sm"size="md"size="lg"States
Each state is one attribute.
DisabledRead-onlyRequiredErrorWith a hintOverview
Single choice by default; multiple adds tick boxes, and ticking a parent ticks everything under it. Up and Down move, Right opens a branch, Left closes it, Enter or Space chooses, typing in the search box filters. value is the choice, or the ticked items joined with commas when multiple; values is the same as a list. Form-associated: submits the value (one entry per ticked item when multiple).
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
values | string | — | The chosen values as a list: the ticked items with multiple, otherwise the one choice (or none). Setting it
sets value (joined with commas). The values='["a","b"]' attribute of 0.2.0 still works; prefer value="a,b". |
options | TreeOption[] | [] | Nested options: { value, label, children? }. Values must be unique across all levels. |
value | string | — | The chosen value; with multiple, the ticked items (the ones without children) joined with commas. |
multiple | boolean | false | Allow several choices, with tick boxes. |
name | string | — | Form field name: the value is submitted under it (one entry per ticked item with multiple). |
label | string | Choose | Visible label (use hide-label to hide it visually). |
placeholder | string | Select… | Shown while nothing is chosen. |
hint | string | — | Help text under the field. |
error | string | — | Custom error message. Setting it marks the field invalid. |
size | 'sm' | 'md' | 'lg' | — | Field size. |
required | boolean | false | The form cannot be submitted until something is chosen. |
disabled | boolean | false | Not interactive and not submitted. |
searchable | boolean | false | Show a search box that filters the tree. |
expand-allprop: expandAll | boolean | false | Start with every branch open. |
hide-labelprop: hideLabel | boolean | false | Hide the label visually; it stays the accessible name. |
readonly | boolean | false | Focusable and submitted, but the user cannot change the value. |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-change | onPmChange | The selection changed. detail.value is detail.values joined with commas. |
Methods
checkValidity(), reportValidity(), validate()