Show true values with checkbox or icon

Hi,
is ist possible to display boolean values correct in the file index.html.heex and show.html.heex? With an checkbox or icon. In the list a true or false are printed.

index.html.heex
" <:col :let={{_id, test}} label=“Possible”}><%= test.possible %></:col>"

show.html.heex
“<:item title={“Possible”}><%= @test.possible %></:item>”

Yes, instead of <%= test.possible %>, try something like this:

<.icon :if={@test.possible} name="hero-check" />
<.icon :if={!@test.possible} name="hero-x-mark" />
# or
<%= if @test.possible %>
  <.icon name="hero-check" />
<% else %>
  <.icon name="hero-x-mark" />
<% end %>

# or as a checkbox input that is disabled since there is no parent form 
<.input type="checkbox" checked={@test.possible} disabled>

1 Like