components/table
データ表示 · 30 / 64

Table

ui.widgets.Table

固定の列定義とカスタム cell renderer を備えた基本テーブル。

BEHAVIOR CONTRACT

列幅、header、striped row、ソートの入口、cell のライフサイクルが明確に分離されています。

RECORDED INTERACTION

実データ 8 行とソート可能な列を示します。

examples/storybook/stories.zig:2446
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;
}
GitHub でソースを見るexamples/storybook/stories.zig:2446

Storybook にあるこの story のコードそのままです(zenit 5f9add5+wip 2026-09-30)。W は ui.widgets のことで、col / row / label は Storybook 内の小さなレイアウトヘルパーです。

zenit · デュアルライセンスオープンソースプロジェクトは GPL-3.0-only のもとで無料で使えます。クローズドソースや商用製品には商用ライセンスが必要です。作者への連絡先:zongyi.xzy#gmail.com(# を @ に置き換え)zenit 5f9add5+wip 2026-09-30