In one of my hobby apps, ComboBox just felt too slow. I tuned its settings, but typing still triggered extra round trips (not related to actual search actually) that the user had to wait for. A while ago I tried to fix this in Vaadin core, but the PR was seen as too big and risky change.
So I built an alternative in Viritin: SearchSelect. It uses exactly the same vaadin-combo-box web component, so it looks, themes and works with the keyboard and screen readers
like any other Vaadin field. But the server side is written from scratch, with one goal: no needless server round trips.
- Up to 1000 items (configurable): zero server visits while typing. The items go to the browser once and are filtered there. Only the selected value comes back.
- Large lists or backend queries: the server is called only when the user pauses typing (300 ms by default), so one request instead of one per keystroke. Meanwhile, results already
in the browser are narrowed down instantly. - Smarter default matching: all words, any order, ignoring case and accents. “pk juo” finds “Juoksu – (PK1) kevyt”. Search logic is configurable (but you must provide the logic in both JS and Java)
- Search by hidden text such as codes or synonyms with setSearchTextGenerator, or plug in your own JS filter.
- A normal HasValue field, so Binder works as usual.
- No custom frontend bundle needed.
var type = new SearchSelect<>("Training type", TrainingType.all());
type.setItemLabelGenerator(TrainingType::label);
// or lazily from a backend, queried only on a typing pause:
select.setItems(q -> repo.findByName(q.getFilter().orElse(""), Limit.of(q.getLimit())).stream());
It’s semantically a Select with search: it doesn’t add new items, so it isn’t a full drop-in replacement for ComboBox. A version that allows new items should be doable, though, if
someone needs it. In my app it has completely replaced ComboBox, and the difference in feel is big.
Available in Viritin (Flow Viritin - Vaadin Add-on Directory) 3.10.0+ (so only for Vaadin 25.4 and newer), docs: SearchSelect – Flow Viritin
Feedback and PRs welcome!