Select

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

Select is used as a controlled component with ngModel 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.

Select is used as a controlled component with ngModel 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

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

check-mark-demo

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

multiple-demo

Multiple selection with checkboxes using multiple and custom #item and #header templates.

checkbox-selection-demo

Selected items displayed as chips using a custom #selectedItem template in multiple mode.

chip-demo

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

editable-demo

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

group-demo

Both the selected option and the options list can be templated to provide customizated representation. Use selectedItem template to customize the selected label display and the item template to change the content of the options in the select panel. In addition when grouping is enabled, group template is available to customize the option groups. All templates get the option instance as the default local template variable.

template-demo

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

filter-demo

Loading state can be used loading property.

loading-state-demo

VirtualScrolling is an efficient way of rendering the options by displaying a small subset of data in the viewport at any time. When dealing with huge number of options, it is suggested to enable VirtualScrolling to avoid performance issues. Usage is simple as setting virtualScroll property to true and defining virtualScrollItemSize to specify the height of an item.

virtual-scroll-demo
lazy-virtual-scroll-demo

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

filled-demo

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

float-label-demo

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

ifta-label-demo

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

clear-icon-demo

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

sizes-demo

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

fluid-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 Angular Forms.

invalid-demo
template-driven-forms-demo

Select can also be used with reactive forms. In this case, the formControlName property is used to bind the component to a form control.

reactive-forms-demo

Screen Reader

Value to describe the component can either be provided with ariaLabelledBy or ariaLabel 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.
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.

Popup Keyboard Support

KeyFunction
tabMoves focus to the next focusable element in the popup, if there is none then first focusable element receives the focus.
shift + tabMoves focus to the previous focusable element in the popup, if there is none then last focusable element receives the focus.
enterSelects the focused option and closes the popup.
spaceSelects the focused option and closes the popup.
escapeCloses the popup, 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.
right arrowIf the select is editable, removes the visual focus from the current option and moves input cursor to one character left.
left 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.
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
enterCloses the popup and moves focus to the select element.
escapeCloses the popup and moves focus to the select element.
ON THIS PAGE
Theme Designer
Theme Designer is the ultimate tool to customize and design your own themes featuring a visual editor, Figma to theme code, cloud storage, and migration assistant.
Learn More