Conditional rendering inside custom table column?

How can I write some custom HTML rendering/templating for a table column ?

I want render HTML inside a custom column.

Something similar to this. This type of conditional rendering can be found in templating libraries like mustache.

{{ if  (currentRow.type == 'goal') { }}
  <a href='www.google.com'>Goal</a>
{{ else if (currentRow.type == 'test') }}
  <a href='www.google.com'>Test</a>
{{ else { }}
  <a href='www.google.com'>Something else</a>
{{ } }}

Is this supported or at least can I render a custom component as a table column ?
I understand that the ternary operator can be used but past 2 conditionals, it starts getting complex.

Thank you

Use a ternary operator and set the column to render as HTML
{{currentRow.type == 'goal'? 'true value':'false value'}}

1 Like

Thank you @ScottR. While ternary operators work for a single conditional rendering, the moment there's more than 1, it becomes awkward to understand or manage.

I was hoping for a more elegant solution, but I understand that this is what Retool supports right now