Attempting to conditionally highlight the background color of values in the select component

I'm trying to highlight the background color of select component values in Retool. Please see the issue I'm facing below:

You can see the values in the select component dropdown. I've already highlighted them with green and red colors, but now I need to change the background as well. If a value is highlighted in green, its background should also be green, and if a value is highlighted in red, its background should be red.

Hey @Arshad_Irshad,

I was intrigued by what you're trying to achieve and made some attempts myself.

It seems that the only way to define the background of the fields is via the "Styles" options at the bottom of the component settings. However, I haven't managed to dynamically change the background of different values based on a condition, it seems this setting can only apply to all values.

Unless I'm missing something, it is currently not possible to dynamically add color background to values, and it would seem an interesting feature request.

Hey @MiguelOrtiz ,

Thank you so much for taking the time to look into this and sharing your insights! I really appreciate your effort. I agree, it would be an awesome feature to have dynamic backgrounds based on conditions. Let's hope they consider it for future updates. Thanks again for your help!

Hi @Arshad_Irshad! Thanks for reaching out.

I agree that this would be a nice feature! I did some quick testing and am able to dynamically change the background color based on external conditions, but the background is applied to all elements.

Just as @MiguelOrtiz found, it seems that the background cannot be set for individual elements. I'll talk to the team about potentially implementing this and let you know where whenever I have an update!

1 Like