Widgets / Table
Table
A sticky-header table with Length-width columns and per-cell renderers.
Signature
Table.view
(height: int)
(headerStyle: Style)
(selStyle: Style)
(topRow: int)
(isSelected: int -> bool)
(columns: Column<'row, 'msg> list)
(rows: 'row list)
: LayoutNode<'msg>
Table.textColumn (header: string) (width: Length) (style: Style) (toStr: 'row -> string) : Column<'row, 'msg> Parameters
| parameter | type | what it is |
|---|---|---|
height | int | Visible body rows (windowed from topRow). |
topRow | int | First visible row — the scroll offset. |
isSelected | int -> bool | Per-row highlight predicate (single or multi-select). |
columns | Column list | Build with Table.textColumn; a column's Render can return any node, not just text. |
rows | 'row list | The data; the columns project each row to cells. |
Notes
Rows are virtualized through topRow/height. A selected row is drawn in the selection style across every column (so the highlight is uniform and readable even where a column carries its own color). Because Column.Render returns a LayoutNode, a cell can be a badge or a progress bar, not only text.
Example
let columns =
[ Table.textColumn "file" (Length.Cells 20) theme.fg (fun r -> r.File)
Table.textColumn "status" (Length.Cells 12) theme.fgMuted (fun r -> r.Status) ]
Table.view 12 theme.fgSubtle theme.selection model.Top
(fun i -> i = model.Selected) columns model.Rows