components/spinner
Display · 24 / 64

Spinner

ui.widgets.Spinner

A compact animation for short waits.

BEHAVIOR CONTRACT

Size, color and frame scheduling are driven by the animation manager.

RECORDED INTERACTION

Keeps live frames, which shows it isn’t a static placeholder.

examples/storybook/stories.zig:638
// ── Spinner ──
pub fn buildSpinner(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
    const a = cx.allocator;
    const r = try row(cx, 20);
    // e2e 墨量断言要框到 spinner 本身:story.<key> 的 rect 还含标题/描述文字,
    // 那些文字的像素会把 spinner 画不出来这件事完全盖住(实测 7600+ dark)。
    r.meta.ownership.meta.test_id = "story.spinner.row";
    try r.appendChild(a, try W.Spinner(.{ .size = 16 }).mount(scope, cx));
    try r.appendChild(a, try W.Spinner(.{ .size = 24 }).mount(scope, cx));
    try r.appendChild(a, try W.Spinner(.{ .size = 36 }).mount(scope, cx));
    return r;
}
View source on GitHubexamples/storybook/stories.zig:638

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.

zenit · Dual-licensedFree for open-source projects under GPL-3.0-only; closed-source or commercial products need a commercial license.Contact the author: zongyi.xzy#gmail.com (replace # with @)zenit 4c50245 2026-10-01