Combo box item caption style with html

We want apply special style to dedicated combo box item caption, like make one item caption display with red color, and others with normal color.

We try to implement it by using html,but do not sucess.

is there any way to do that?
19006.png

Using css:

ComboBox comboBox = new ComboBox("Test"); comboBox.addStyleName("red"); and in your theme’s ,scss file:

  .v-caption-red {
      color: red;
  }

Using html:

        ComboBox comboBox = new ComboBox(
                "<span style=\"color: red;\">Test</span>");
        comboBox.setCaptionAsHtml(true);

thanks.

You just change the style of combo box caption , we want to change style of one of items in combo box.

eg. only change the “ARGENTINA” item’s font color to read,and keep the others unchange ( screenshot in attachment)

You are right, I misread the original question, sorry about that. Styling an item in the popup would be considerably more difficult. I’ll have to think about that some more.

I’ve been glancing through the ComboBox code a bit, and I suspect this would require at least extending the client-side, possibly even overriding it, but I haven’t found enough time for a proper deep-dive to figure out what exactly would need to be changed. Modifying ComboBox is rarely easy, I’m afraid, and although there has been a
feature request
for this for a long time it hasn’t got implemented yet.

If you (or someone else) do figure out a solution for this, please share.

Its been 4 years since this issue has been raised.

Is there any chance to achieve this now?