Table
A scrollable data table with configurable columns, fixed widths, a row cursor and per-row/per-cell styling via a styleFunc. Handles more rows than fit by scrolling within a fixed height.
Install the package
Every component ships in the single dart_tui package.
$dart pub add dart_tui

TableModel(
columns: [
TableColumn('City', 20),
TableColumn('Population', 12),
],
rows: const [
['Tokyo', '37,400,068'],
['Delhi', '28,514,000'],
['Shanghai', '25,582,000'],
],
height: 10,
styles: TableStyles(
header: const Style(isBold: true, isUnderline: true),
),
);TableModel
| Property | Type | Description |
|---|---|---|
| columns | List<TableColumn> | Column definitions — each a (title, width). |
| rows | List<List<String>> | Row data; one inner list per row. |
| cursor | int | Index of the highlighted row. |
| height | int | Visible rows before scrolling. Defaults to 10. |
| styles | TableStyles | Header style plus a styleFunc(row, col) for per-cell styling. |
Keybindings
↑ / k, ↓ / jMove row cursor