Form
TreeSelect
A select over a tree, with the same filter and checkbox selection as Tree.
WAI-ARIA tested
Import
main.ts
import { TreeSelect } from '@vitral/vue';Basic
Value: null
Checkboxes and chips
Filter and multiple
Sizes and states
API
Read from packages/vue/src/components/TreeSelect/types.ts, so it says what the component actually accepts.
Props
| Name | Type | Description |
|---|---|---|
| options | TreeNodeLike[] | The tree to choose from. |
| selectionMode | 'single' | 'multiple' | 'checkbox' | `'single'` (the default) closes on a choice; `'multiple'` and `'checkbox'` stay open. |
| placeholder | string | — |
| display | 'comma' | 'chip' | How the choice is shown: a comma-separated list (the default) or chips. |
| maxSelectedLabels | number | Past this many, the field says how many are chosen instead of naming them. |
| selectedItemsLabel | string | What it says then. `{count}`; defaults to the locale's selection message. |
| filter | boolean | Adds a search box above the tree. |
| filterBy | string | string[] | Node fields to search, as a list or comma-separated. Defaults to `label`. |
| filterPlaceholder | string | — |
| emptyMessage | string | — |
| showClear | boolean | — |
| loading | boolean | — |
| disabled | boolean | — |
| invalid | boolean | — |
| size | Size | — |
| variant | InputVariant | — |
| fluid | boolean | — |
| placement | OverlayPlacement | — |
| appendTo | string | `'body'` (the default), `'self'` to render in place, or a selector. |
Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.
Emits
| Event | Payload | Description |
|---|---|---|
| change | value: TreeSelectValue | — |
| node-select | node: TreeNodeLike | — |
| node-unselect | node: TreeNodeLike | — |
| node-expand | node: TreeNodeLike | — |
| node-collapse | node: TreeNodeLike | — |
| filter | query: string | — |
| show | — | — |
| hide | — | — |
| focus | event: FocusEvent | — |
| blur | event: FocusEvent | — |
Slots
| Name | Slot props | Description |
|---|---|---|
| value | (props: { value: TreeNodeLike[]; placeholder?: string }) | The field's content. |
| option | (props: { node: TreeNodeLike; expanded: boolean; selected: boolean; checked: boolean }) | A node's content in the tree. |
| header | — | — |
| footer | — | — |
| empty | — | — |
| dropdownicon | (props: { open: boolean }) | — |