Form
MultiSelect
A select for several choices, shown as a list, a count or chips, with an optional filter.
WAI-ARIA tested
Import
main.ts
import { MultiSelect } from '@vitral/vue';Basic
Value: SP
Chips and filter
Groups and a selection limit
Sizes and states
API
Read from packages/vue/src/components/MultiSelect/types.ts, so it says what the component actually accepts.
Props
| Name | Type | Description |
|---|---|---|
| options | any[] | — |
| optionLabel | string | Field (dotted path) holding an option's text. Without it, options are shown as they are. |
| optionValue | string | Field holding the value v-model collects. Without it, the whole option is the value. |
| optionDisabled | string | — |
| optionGroupLabel | string | Turns `options` into groups: this field is each group's label… |
| optionGroupChildren | string | …and this one its options. Defaults to `items`. |
| dataKey | string | Compare object values by this field instead of structurally. |
| 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. |
| selectionLimit | number | No more than this many may be chosen. |
| showToggleAll | boolean | Show the select-all box in the header. Defaults to true. |
| filter | boolean | Adds a search box to the panel. |
| filterPlaceholder | string | — |
| filterFields | string[] | Fields to search instead of the label. |
| filterMatchMode | string | Any registered match mode; accent- and case-insensitive `contains` by default. |
| resetFilterOnHide | boolean | Empty the search box when the panel closes. |
| showClear | boolean | — |
| loading | boolean | — |
| emptyMessage | string | — |
| emptyFilterMessage | string | — |
| 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 | event: MultiSelectChangeEvent | — |
| selectall-change | event: { originalEvent: Event; checked: boolean } | — |
| show | — | — |
| hide | — | — |
| filter | query: string | — |
| focus | event: FocusEvent | — |
| blur | event: FocusEvent | — |
Slots
| Name | Slot props | Description |
|---|---|---|
| value | (props: { value: unknown[]; options: unknown[]; placeholder?: string }) | The field's content. |
| option | (props: { option: unknown; index: number; selected: boolean; focused: boolean }) | — |
| optiongroup | (props: { group: unknown }) | — |
| header | — | — |
| footer | — | — |
| empty | — | — |
| dropdownicon | (props: { open: boolean }) | — |