ComboBox, make Icon appear only in drop down or text field

Hi,

sorry, I could not find an answer searching the forums.

When I try to create icons for Combobox items, like so (please disregard that I’m using immutable DTOs): binder.addStatusChangeListener(sc -> featureCombo.setItems(binder.getBean().options())); binder.setBean(bean); binder.forField(featureCombo).bind(bean -> bean.selectedOption(), (bean, value) -> binder.setBean(bean.withSelectedOption(value))); featureCombo.setItemIconGenerator(itm -> Objects.equals(itm, binder.getBean().currentOption()) ? VaadinIcons.CHECK_CIRCLE : null); The idea behind it is that I try to have an icon show up in the drop down, where the item is the “current” option (i.e. the one that is saved).
Like so:

Option1

Option 1
*Option 2
Option 3

Now if I select an option that is also the “current” (saved) option, I get this:

*Option2

Option 1
*Option 2
Option 3


Is there any way to make the combo box icons only show up in the drop down and not in the text field?

Or is there a way to tun it around like so:

binder.addStatusChangeListener(sc -> featureCombo.setItems(binder.getBean().options())); binder.setBean(bean); binder.forField(featureCombo).bind(bean -> bean.selectedOption(), (bean, value) -> binder.setBean(bean.withSelectedOption(value))); featureCombo.setItemIconGenerator(itm -> Objects.equals(itm, binder.getBean().currentOption()) ? null : VaadinIcons.EXCLAMATION_CIRCLE_O); If I do this, the Idea would be to mark a “new” (unsaved) option in the text box, but not in the drop down, like so:

(!) Option1

Option 1
Option 2
(current)

Option 3

Alas, If I do the above, what I will get is this:

(!) Option1

(!)Option 1
Option 2
(current)

(!)Option 3


Is it possible to make the icons only show up in the text field, but not in the drop down?

(The most flexible way to handle siilar cases would probably to create separate icon generators for the text field and the drop down).