Table
A responsive table component.
Anatomy
Table do |t|t.captiont.header dot.row dot.headt.headendendt.body dot.row dot.cellt.cellendendt.footer dot.row dot.cellt.cellendendend
API Reference
Table
| Name | Type | |
|---|---|---|
attributes | keyword arguments |
Table#caption
| Name | Type | |
|---|---|---|
attributes | keyword arguments |
Table#header
| Name | Type | |
|---|---|---|
attributes | keyword arguments |
Table#row
| Name | Type | |
|---|---|---|
attributes | keyword arguments |
Table#head
| Name | Type | |
|---|---|---|
attributes | keyword arguments |
Table#body
| Name | Type | |
|---|---|---|
attributes | keyword arguments |
Table#cell
| Name | Type | |
|---|---|---|
attributes | keyword arguments |
Table#footer
| Name | Type | |
|---|---|---|
attributes | keyword arguments |
Table#rows (Builder)
Builder method for programmatically generating table content from data arrays. Automatically creates header and body sections with defined columns.
| Name | Type | Default |
|---|---|---|
required rows | array | |
| 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.
| Name | Type | Default |
|---|---|---|
required header | string | |
| The column header text displayed in the table head section. | ||
head_class: | string | nil |
| Additional CSS classes to apply to the column's header cell (th element). | ||
cell_class: | string | nil |
| Additional CSS classes to apply to all data cells (td elements) in this column. | ||
required &content | block | |
| A block that receives each row object and returns the content for this column's cells. Used to extract and format data. | ||
Examples
On This Page