stein_phoenix v0.2.0 Stein.Phoenix.Views.TableHelper View Source

Helper functions to create Bootstrap 4 tables

<%= table do %>
  <%= header ["Name", "Email", "Actions"]

  <%= body %>
    <%= Enum.map(@users, fn user -> %>
      <%= row do %>
        <%= column do: user.name %>
        <%= column do: user.email %>
        <%= column do %>
          <%= link("View", to: Routes.user_path(@conn, :show, @user.id)) %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

Link to this section Summary

Functions

Creates the table body tag

Create a column tag

Creates the table head and a header row

Creates a table row tag

Top level wrapper for a table

Link to this section Functions

Creates the table body tag

Create a column tag

Aligns vertically in the row

<%= column do: @user.name %>

Creates the table head and a header row

  <%= header ["Name", "Email", "Actions"] %>

Creates a table row tag

<%= row do %>
  <%= column do: @user.name %>
<% end %>

Top level wrapper for a table

Creates a bordered and responsive table.