Incubator Autocomplete:
Autocomplete is a Web Component providing an easy way to provide an autocomplete functionality.
How is it used?
A simple use of the Autocomplete component would be the following.
H3 inputH3 = new H3("Current input: ");
H3 selectionH3 = new H3("Selection: ");
Autocomplete autocomplete = new Autocomplete(5);
autocomplete.addChangeListener(event -> {
String text = event.getValue();
autocomplete.setOptions(findOptions(text));
inputH3.setText("Current input: " + text);
});
autocomplete.addAutocompleteValueAppliedListener(event -> {
selectionH3.setText("Selection: " + event.getValue());
});
autocomplete.addValueClearListener(event -> {
selectionH3.setText("Selection: " + "");
});
autocomplete.setLabel("Find what you want:");
autocomplete.setPlaceholder("search ...");