Table
ui.widgets.TableA basic table with fixed columns and custom cells.
BEHAVIOR CONTRACT
Column widths, header, striped rows, sorting and cell lifetime are separate concerns.
RECORDED INTERACTION
Shows eight real rows and sortable columns.
pub fn buildTable(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
const cols = [_]W.ColumnDef{
.{ .id = "name", .header = "Name", .width = 160 },
.{ .id = "role", .header = "Role", .width = 120 },
.{ .id = "age", .header = "Age", .width = 80, .sortable = true },
};
const t = try W.Table(.{ .columns = &cols, .row_count = 8, .striped = true, .render_cell = tableCell }).mount(scope, cx);
return t.wrapper;
}The story's verbatim source from the Storybook (zenit 4c50245 2026-10-01). W is ui.widgets; col / row / label are small Storybook layout helpers.
TableProps
ui.widgets.Tablefn Table(props: TableProps) TableBuilderField
Type
Default
Description
columns[]const ColumnDef&.{}—
row_countusize0—
row_heightf3236—
header_heightf3240—
stripedboolfalse—
hoverablebooltrue—
table_width?f32null—
table_heightf32400—
render_cell?CellRenderFnnull—
on_sort?core.HandlerRefnull—
on_row_click?core.HandlerRefnull—
TableResult
ui.widgets.TableField
Type
Default
Description
wrapper*Node—
—
state*TableState—
—
vl_state?*VirtualListStatenull虚拟滚动模式下的 VirtualListState(可用于动态更新 row_count)