New to Kendo UI for Angular? Start a free 30-day trial

Suggestions

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.

Enabling Suggestions

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.

Example
View Source
Change Theme:

Controlling the List with Suggestions

To set the state of the list:

  1. Configure the initially opened component
  2. Prevent the emitted open and close events
  3. Avoiding the focus on the first available match

You can also retrieve the current open state of the suggestions list by using the isOpen getter.

Setting the Initially Opened Component

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.

Example
View Source
Change Theme:

Preventing Opening and Closing

The open and 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.

Example
View Source
Change Theme:

Avoiding the Focus on the First Available Match

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 false.

Example
View Source
Change Theme: