Interface Typeahead<M extends MenuToggleMenu<M>>
- All Known Implementing Classes:
MultiTypeahead,SingleTypeahead
public interface Typeahead<M extends MenuToggleMenu<M>>
-
Method Summary
Modifier and TypeMethodDescriptiondefault MallowNewItems(Function<String, Promise<MenuItem>> createItem) Allows the creation of new menu items based on user input.Allows the creation of new menu items based on user input.onNoResults(NoResults noResults) Configures the behavior for generating a "no results" menu item when no matching items are found in the menu list for the given input text.onSearch(SearchFilter searchFilter) Configures the search behavior for this typeahead.
-
Method Details
-
allowNewItems
Allows the creation of new menu items based on user input. This method enables the typeahead component to dynamically add custom items when the provided input does not match any existing items. A default prompt is used to guide the user with a message like "Create new item ''". -
allowNewItems
Allows the creation of new menu items based on user input. This method enables a typeahead component to provide functionality for dynamically adding custom items when the user-provided input does not match any existing items.- Parameters:
prompt- aFunctionthat takes aStringinput representing the user's data and returns aStringresponse, typically used to prompt the user or display a message.createItem- aFunctionthat takes aStringinput representing the user's data and returns aPromiseof aMenuItem, representing the newly created item.- Returns:
- an instance of the enclosing type, enabling method chaining for further configuration.
-