Conditional background color on component

Hi,

On a form component table, I can change the background color of a cell based on it’s value, which is great. For example, to set the color, use {{ self > 10 ? 'green' : 'red' }} .

In a standard component (text / text input etc) I can’t. Is there some way around it to apply conditional formatting there?

Thanks
Michel

Hey there @mm79! We don’t support custom styling for every component. You can apply custom CSS, but that’s not going to be able to be conditional. What’s your use case / what are you trying to accomplish here?

For text components, you can choose the text color - in the input for the hex color, you can actually write Javascript for conditional coloring (even though the editor doesn’t look like it lets you do that).

Hello Justin,

I just wanted to create some extra focus on certain field/values, for instance values below 0 in red. For instance in a dashboard or settings page.

For text components, you can choose the text color - in the input for the hex color, you can actually write Javascript for conditional coloring (even though the editor doesn’t look like it lets you do that).

Oh this is great, good to know. Thanks!

1 Like