Table
ui.widgets.Table固定の列定義とカスタム cell renderer を備えた基本テーブル。
BEHAVIOR CONTRACT
列幅、header、striped row、ソートの入口、cell のライフサイクルが明確に分離されています。
RECORDED INTERACTION
実データ 8 行とソート可能な列を示します。
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;
}Storybook にあるこの story のコードそのままです(zenit 5f9add5+wip 2026-09-30)。W は ui.widgets のことで、col / row / label は Storybook 内の小さなレイアウトヘルパーです。
TableProps
ui.widgets.Tablefn Table(props: TableProps) TableBuilderフィールド
型
デフォルト値
説明
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.Tableフィールド
型
デフォルト値
説明
wrapper*Node—
—
state*TableState—
—
vl_state?*VirtualListStatenull虚拟滚动模式下的 VirtualListState(可用于动态更新 row_count)