Setting my own color scheme for tags in the tag data type in a table

This seems so simple but I can't figure it out.

I have a table in a modal, and I have the column "rating" which is a tag type column with three possible values

  • pass
  • fail

The default colors are blue, light blue and something else, but I just want a straightforward green/red/yellow

When I unclick "Automatically Select Colors" it opens up a field for Color but I can't figure out what to enter there to get the result I want. Any help is appreciated!

Hi @TheDukeLeto! In the Color input you can use the Javascript ternary operator to conditionally render the rating. To access the column value you can use the item keyword.

Here's what it should look like:
Code: {{item === 'pass' ? 'green' : item === 'unrated' ? 'yellow' : 'red'}}

Hopefully that helps!

1 Like

That worked!!!


1 Like