Table

Dense lists of records, declared column by column.

Helper
table(
  rows:,
  row_href: nil,   # ->(row) { url }
  current: nil,    # ->(row) { true for the open row }
  group_by: nil,   # ->(row) { group label }
  collapsible: false,
  collapsed: [],   # group labels that start folded
  empty: "Nada por aqui.",
  min_width: nil
) do |t|
  t.column(header, align: :left, width: nil) { |row| … }
  t.empty { … }    # instead of empty:
end

Simple

Each column block receives the row and returns the cell (a value or ERB). Right-align money and quantities; numbers are tabular.

EmpresaCNPJMunicípioNotas
Empresa Exemplo Ltda12.345.678/0001-90São Paulo/SP1.204
Fictícia Serviços ME98.765.432/0001-10Campinas/SP318
Demo Consultoria11.222.333/0001-44Curitiba/PR42

Grouped, clickable, current row

group_by adds a header row per group with its count. row_href makes whole rows clickable without stealing clicks from links, buttons and checkboxes inside them. current marks the row whose drawer is open. min_width keeps columns readable: the table scrolls sideways inside its box.

NúmeroTomadorEmissãoValorSituação
Novembro de 2026 · 2
1234Empresa Exemplo Ltda05/11/2026R$ 1.500,00 Autorizada
1235Fictícia Serviços ME07/11/2026R$ 820,50 Autorizada
Outubro de 2026 · 1
1201Demo Consultoria28/10/2026R$ 3.200,00 Cancelada

Collapsible groups

With collapsible: true each group header becomes a button that folds its rows away (the chevron turns). collapsed: lists the groups that start folded. Each group is its own <tbody>, so folding works without moving rows around.

MissãoData
Revisar roteiro do vídeo 220/11/2026
Editar vídeo 221/11/2026
Publicar vídeo 227/11/2026
Follow-up com a Demo Consultoria24/11/2026
Publicar landing do emissor23/11/2026
Emitir invoice de novembro20/11/2026

Selection, status and row actions

A column header can be any markup, like a select-all checkbox. Put row actions in a narrow right-aligned last column as icon buttons with labels that name the record.

EmpresaTipoValidadeSituação
Empresa Exemplo LtdaA114/03/2027Válido
Demo ConsultoriaA104/12/2026Vence em 12 dias
Loja Modelo EireliA302/09/2026Vencido

Without data

With no rows the table keeps its header, so it still reads as a table, and shows an empty state across the body. empty: takes a plain sentence (first card); t.empty { … } takes any markup, usually an empty_state with an icon, a description that names the filter and a way out (second card).

Notas emitidas

Só com o texto padrão

NúmeroTomadorEmissãoValor

Nenhuma nota por aqui.

Notas emitidas

Com um empty state completo

NúmeroTomadorEmissãoValor

Nenhuma nota neste filtro

Nenhuma nota emitida entre 01/11 e 30/11 para Demo Consultoria.

In a card, with pagination

card(flush: true) lets the table fill the card edge to edge; pagination goes in the card footer.

Últimas notas

Página 2 de 12

Ver todas
NúmeroTomadorValor
1239Fictícia Serviços MER$ 310,00
1238Demo ConsultoriaR$ 620,00
1237Empresa Exemplo LtdaR$ 930,00
1236Fictícia Serviços MER$ 1240,00
1235Demo ConsultoriaR$ 1550,00

Options

OptionWhat it does
rowsAny enumerable
row_hrefLambda row → URL; the row becomes a link
currentLambda row → true for the row whose drawer is open
group_byLambda row → group label
collapsibleGroup headers fold and unfold their rows
collapsedGroup labels that start folded
emptySentence shown when there are no rows (or use t.empty { … })
min_widthCSS width that keeps columns readable; the table scrolls inside its box