components/grid
レイアウトと大規模データ · 51 / 64

Grid

ui.widgets.mountGrid

2 次元の行列データとカスタム cell renderer。

BEHAVIOR CONTRACT

列幅、行の高さ、スクロールウィンドウ、cell 座標はアプリのノードに混ざりません。

RECORDED INTERACTION

harness がグリッドをスクロールし、表示ウィンドウが更新されます。

examples/storybook/stories.zig:3005
pub fn buildGrid(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
    const widths = [_]f32{ 90, 90, 90, 90 };
    const g = try W.mountGrid(.{
        .col_count = 4,
        .row_count = 12,
        .col_widths = &widths,
        .cell_height = 30,
        .width = 380,
        .height = 320,
        .cell_render_fn = gridCell,
    }, scope, cx);
    return g.root;
}
GitHub でソースを見るexamples/storybook/stories.zig:3005

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