Select component | Vaadin components

This topic is the discussion thread for the Vaadin documentation page Select component | Vaadin components.

Questions, feedback, and comments are welcome here.

The docs says it has a clearButton, but seems like there is no clearButton on Select component and no API provided for it either.

Am I missing something?

Thank you for pointing this out. You are right - the Select component does not support the clear button. I am updating the documentation under this PR: https://github.com/vaadin/docs/pull/3349

Funny that this component has no constructor that will accept a simply label as parameter like other components do, but need a combination of a label and a listener.

I see some inconsistency between Select and ComboBox on mobile devices when it comes to the overlay position. For Select it goes to the bottom of the screen while for ComboBox it stays under the input. Is there any possibility to force the overlay position for Select to stay with the input even when on a phone?

Why is there not a way to add empty selection item in react? Or will this be added later on?

Vaadin ver. 24.2.1

Component: com.vaadin.flow.component.select.Select

The method setItemLabelGenerator(label_generator) will cause a NPE if the component sets its attribute EmptySelectionAllowed to true.

The implementation looks error-prone:

public void setItemLabelGenerator(
            ItemLabelGenerator<T> itemLabelGenerator) {
    this.itemLabelGenerator = itemLabelGenerator;
    refreshItems();
}

private void refreshItems() {
getItems().forEach(this::updateItem);
}

@SuppressWarnings(“unchecked”)
private Stream<VaadinItem<T>> getItems() {
return listBox.getChildren()
            .filter(component -> component instanceof VaadinItem)
                .map(child -> (VaadinItem<T>) child);
}


This will change in Vaadin 25, so that both Combo Box and Select behave similarly, keeping the overlay attached to the input. That said, the behavior stays the same in Lumo. Only the base styles and the new Aura theme will use the updated behavior.