The AutoComplete provides suggestions which appear while the user types in the input field and a number of settings for controlling the behavior of its suggestions list.
To enable the list with suggestions, set the
suggest property of the AutoComplete to
true. Whenever the user modifies the input value, the AutoComplete automatically completes the user input with the first text match. If the first text match does not begin with the current user input, the AutoComplete displays no suggestions.
To set the state of the list:
- Configure the initially opened component
- Prevent the emitted
- Avoiding the focus on the first available match
You can also retrieve the current open state of the suggestions list by using the
You can enable the user to manually toggle between the open and close state of the suggestion list by setting the
toggle method. If set to
true, the method defines that the suggestion list is open. If set to
false, the method defines that the suggestion list is closed.
The following example demonstrates how to configure an initially opened AutoComplete.
close events are emitted right before the suggestion list is about to open or close. To prevent the corresponding action, call the
preventDefault method of the event argument.
In the following example, the AutoComplete does not close its popup when we select a value using ENTER or a mouse click. It only closes the popup when the component loses focus.
By default, when the user types an input, the AutoComplete allows for a quick selection and focuses the first available match from its suggestion list. To avoid that behavior, set the
highlightFirst input property of the AutoComplete to