class RatatuiRuby::Table

Displays structured data in rows and columns.

Data is often multidimensional. You need to show relationships between fields (Name, Age, ID). Aligning columns manually in a monospaced environment is painful and error-prone.

This widget creates a grid. It enforces column widths using constraints. It renders headers, rows, and footers aligned perfectly.

Use it to display database records, logs, or file lists.

Examples

Table.new(
  header: ["ID", "Name", "Status"],
  rows: [
    ["1", "Hideo", "Active"],
    ["2", "Kojima", "Idle"]
  ],
  widths: [
    Constraint.length(5),
    Constraint.fill(1),
    Constraint.length(10)
  ]
)