Form
Select
Choose one option from a list, with an optional filter that ignores case and accents.
WAI-ARIA tested
Import
main.ts
import { Select } from '@vitral/vue';Basic
Value: null
Filter
Groups
Sizes and states
API
Read from packages/vue/src/components/Select/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 receives. 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 | — |
| disabled | boolean | — |
| invalid | boolean | — |
| size | Size | — |
| variant | InputVariant | — |
| fluid | boolean | — |
| filter | boolean | Adds a search box to the panel: the combobox. |
| filterPlaceholder | string | — |
| filterFields | string[] | Fields to search instead of the label. |
| filterMatchMode | string | Any registered match mode; accent- and case-insensitive `contains` by default. |
| showClear | boolean | — |
| loading | boolean | — |
| checkmark | boolean | Marks the selected option with a check, as well as with the highlight. |
| emptyMessage | string | — |
| emptyFilterMessage | string | — |
| 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: SelectChangeEvent | — |
| show | — | — |
| hide | — | — |
| filter | query: string | — |
| focus | event: FocusEvent | — |
| blur | event: FocusEvent | — |
Slots
| Name | Slot props | Description |
|---|---|---|
| value | (props: { value: unknown; option: unknown; placeholder?: string }) | — |
| option | (props: { option: unknown; index: number; selected: boolean; focused: boolean }) | — |
| optiongroup | (props: { group: unknown }) | — |
| header | — | — |
| footer | — | — |
| empty | — | — |
| dropdownicon | (props: { open: boolean }) | — |