Tag component custom color

Hi i got this tag component, any chance to have custom color ? depending on a value in a mysql db? if Active then color should be green, if inactive then should be Red

thank you

Hi @agaitan026
It depends if you are using Manual or Mapped options when it comes to connecting the data source.
If you are using mapped option you can set it in Mapped tags using ternary operator like this


If you are using Manual you can add options and manually add color you want in the options

Hope this helps

1 Like

I have different options as im using self host version, maybe i should wait updates?

This is my tag component:

self hosted v3.69.1

Could you try with the ternary operator in Tag colors, where it now has {{theme.automatic}} ?

1 Like

it shows SyntaxError: Unexpected token ')'

{{ item === 'ACTIVO' ? theme.success : item === 'SUSPENDIDO' ? theme.danger : 'transparent' }}


Can you try this?

1 Like

ReferenceError: item is not defined

would trying Styles option for color work instead? Not sure what options are available to you there

1 Like

it works like that i put tags1.value but now its not getting the correct color of theme.sucess should be green not red i got only two tags ACTIVO and SUSPENDIDO

Hi @agaitan026! It looks like @Milan_Kalem has just about solved your problem but I wanted to hop in and hopefully get the last bit of functionality implemented.

I'm pretty sure tags1.value should return an array, given that the "Tags" component can hold multiple elements. As such, your ternary should reference tags1.value[0] instead of just tags1.value. I hope that helps! :slightly_smiling_face:

If you do want to use the newer version of the "Tags" component, you should upgrade to at least version 3.72!

1 Like