Select

Select is used to choose an item from a collection of options.

PREVIEW

Select is used as a controlled component with v-model property along with an options collection. Label and value of an option are defined with the optionLabel and optionValue properties respectively. Note that, when options are simple primitive values such as a string array, no optionLabel and optionValue would be necessary.

basic-demo

When multiple is enabled, multiple items can be selected. Use checkmark to display a check indicator and a custom #value slot for the label.

multiple-demo

An alternative way to highlight the selected option is displaying a checkmark instead.

checkmark-demo

Multiple selection with checkboxes using multiple and custom #option and #header slots.

checkbox-selection-demo

Selected items displayed as chips using a custom #value slot in multiple mode.

chip-demo

When showClear is enabled, a clear icon is displayed to clear the value.

clearicon-demo

Select provides built-in filtering that is enabled by adding the filter property.

filter-demo

Custom content can be placed inside options using the #option slot.

option-demo

Options can be grouped when a nested data structures is provided.

group-simple-demo

Customize group headers with custom rendering using the #optiongroup slot.

group-custom-demo

Combine grouped options, checkbox selection, and a filter to create a rich multi-select experience.

group-checkbox-filter-demo

A floating label appears on top of the input field when focused. Visit FloatLabel documentation for more information.

floatlabel-demo

IftaLabel is used to create infield top aligned labels. Visit IftaLabel documentation for more information.

iftalabel-demo

The fluid prop makes the component take up the full width of its container when set to true.

fluid-demo

Select provides small and large sizes as alternatives to the base.

sizes-demo

Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.

filled-demo

When disabled is present, the element cannot be edited and focused.

disabled-demo

The invalid state is applied using the invalid property to indicate failed validation, which can be integrated with form validation libraries.

invalid-demo

Customize keyboard and mouse focus behavior with autoOptionFocus, selectOnFocus, and focusOnHover properties.

focusbehavior-demo

When editable is present, the input can also be entered with typing.

editable-demo

Both the selected option and the options list can be templated to provide customizated representation. Use the #value slot to customize the selected label display and the #option slot to change the content of the options in the select panel. In addition when grouping is enabled, the #optiongroup slot is available to customize the option groups. The #option and #optiongroup slots receive the option instance, whereas the #value slot receives the selected value itself; when optionValue is set this is the resolved value rather than the option object, so look the option up from your options if you need its other fields.

template-demo

Loading state is enabled with the loading property.

loadingstate-demo

VirtualScroller is used to render a long list of options efficiently like 100K records in this demo. The configuration is done with virtualScrollerOptions property, refer to the VirtualScroller for more information about the available options as it is used internally by Select.

virtualscroll-demo
lazyvirtualscroll-demo

Select integrates seamlessly with the PrimeVue Forms library.

forms-demo

Screen Reader

Value to describe the component can either be provided with aria-labelledby or aria-label props. The select element has a combobox role in addition to aria-haspopup and aria-expanded attributes. If the editable option is enabled aria-autocomplete is also added. The relation between the combobox and the popup is created with aria-controls and aria-activedescendant attribute is used to instruct screen reader which option to read during keyboard navigation within the popup list.

The popup list has an id that refers to the aria-controls attribute of the combobox element and uses listbox as the role. Each list item has an option role, an id to match the aria-activedescendant of the input element along with aria-label, aria-selected and aria-disabled attributes.

If filtering is enabled, filterInputProps can be defined to give aria-* props to the filter input element.

Closed State Keyboard Support

KeyFunction
tabMoves focus to the select element.
spaceOpens the popup and moves visual focus to the selected option, if there is none then first option receives the focus.
enterOpens the popup and moves visual focus to the selected option, if there is none then first option receives the focus.
down arrowOpens the popup and moves visual focus to the selected option, if there is none then first option receives the focus.
up arrowOpens the popup and moves visual focus to the selected option, if there is none then last option receives the focus.
any printable characterOpens the popup and moves focus to the option whose label starts with the characters being typed, if there is none and select is not editable then first option receives the focus.

Popup Keyboard Support

KeyFunction
tabMoves focus to the next focusable element in the popup. If there is none, the focusable option is selected and the overlay is closed then moves focus to next element in page.
shift + tabMoves focus to the previous focusable element in the popup. If there is none, the focusable option is selected and the overlay is closed then moves focus to next element in page.
enterSelects the focused option and closes the popup, then moves focus to the select element.
spaceSelects the focused option and closes the popup, then moves focus to the select element.
escapeCloses the popup, then moves focus to the select element.
down arrowMoves focus to the next option, if there is none then visual focus does not change.
up arrowMoves focus to the previous option, if there is none then visual focus does not change.
alt + up arrowSelects the focused option and closes the popup, then moves focus to the select element.
left arrowIf the select is editable, removes the visual focus from the current option and moves input cursor to one character left.
right arrowIf the select is editable, removes the visual focus from the current option and moves input cursor to one character right.
homeIf the select is editable, moves input cursor at the end, if not then moves focus to the first option.
endIf the select is editable, moves input cursor at the beginning, if not then moves focus to the last option.
pageUpJumps visual focus to first option.
pageDownJumps visual focus to last option.
any printable characterMoves focus to the option whose label starts with the characters being typed if select is not editable.

Filter Input Keyboard Support

KeyFunction
down arrowMoves focus to the next option, if there is none then visual focus does not change.
up arrowMoves focus to the previous option, if there is none then visual focus does not change.
left arrowRemoves the visual focus from the current option and moves input cursor to one character left.
right arrowRemoves the visual focus from the current option and moves input cursor to one character right.
homeMoves input cursor at the end, if not then moves focus to the first option.
endMoves input cursor at the beginning, if not then moves focus to the last option.
enterCloses the popup and moves focus to the select element.
escapeCloses the popup and moves focus to the select element.
tabMoves focus to the next focusable element in the popup. If there is none, the focusable option is selected and the overlay is closed then moves focus to next element in page.
Theme Designer