Table

(╯°□°)╯︵ ┻━┻
Includes a Ruby component and corresponding Rails helper
Ruby
Header 1 Header 2 Header 3
Row 1 Row 1 Row 1
Row 2 Row 2 Row 2
Row 3 Row 3 Row 3
Row 4 Row 4 Row 4
Row 5 Row 5 Row 5
<%= nk_table do |t| %>
  <%= t.thead do %>
    <%= t.th "Header" %>
  <% end %>
  <%= t.tbody do %>
    <%= t.tr do %>
      <%= t.td "Cell" %>
    <% end %>
  <% end %>
<% end %>

Install

Set up Nitro Kit then

bin/rails generate nitro_kit:add table

Usage

nk_table(**attrs) { |table| ... }
PropertyDefaultDescription
**attrsHTML attributes for <table> element
table.thead(**attrs) { ... }
PropertyDefaultDescription
**attrsHTML attributes for <thead> element
table.tbody(**attrs) { ... }
PropertyDefaultDescription
**attrsHTML attributes for <tbody> element
table.tr(**attrs) { ... }
PropertyDefaultDescription
**attrsHTML attributes for <tr> element
table.th(text = nil, **attrs) { ... }
PropertyDefaultDescription
textnilPlain text content
**attrsHTML attributes for <th> element
table.td(text = nil, **attrs) { ... }
PropertyDefaultDescription
textnilPlain text content
**attrsHTML attributes for <td> element