Table

A responsive table component.

Anatomy

Table do |t|
t.caption
t.header do
t.row do
t.head
t.head
end
end
t.body do
t.row do
t.cell
t.cell
end
end
t.footer do
t.row do
t.cell
t.cell
end
end
end

API Reference

Table

NameType
attributeskeyword arguments

Table#caption

NameType
attributeskeyword arguments

Table#header

NameType
attributeskeyword arguments

Table#row

NameType
attributeskeyword arguments

Table#head

NameType
attributeskeyword arguments

Table#body

NameType
attributeskeyword arguments

Table#cell

NameType
attributeskeyword arguments
NameType
attributeskeyword arguments

Table#rows (Builder)

Builder method for programmatically generating table content from data arrays. Automatically creates header and body sections with defined columns.

NameTypeDefault
required rowsarray
An array of objects or hashes representing table data. Each item becomes a table row with cells generated from column definitions.

Table#column (Builder)

Builder method for defining table columns when using the rows builder. Must be called before the rows method to define column structure.

NameTypeDefault
required headerstring
The column header text displayed in the table head section.
head_class:stringnil
Additional CSS classes to apply to the column's header cell (th element).
cell_class:stringnil
Additional CSS classes to apply to all data cells (td elements) in this column.
required &contentblock
A block that receives each row object and returns the content for this column's cells. Used to extract and format data.

Examples