---
title: "Spinner component | zenit Zig UI"
description: "A compact animation for short waits. Size, color and frame scheduling are driven by the animation manager."
url: https://ui.surf/zenit/components/spinner
language: en
alternate_zh: https://ui.surf/zenit/zh/components/spinner.md
alternate_es: https://ui.surf/zenit/es/components/spinner.md
alternate_ja: https://ui.surf/zenit/ja/components/spinner.md
alternate_ko: https://ui.surf/zenit/ko/components/spinner.md
alternate_fr: https://ui.surf/zenit/fr/components/spinner.md
alternate_de: https://ui.surf/zenit/de/components/spinner.md
project: zenit v0.1.0-alpha (Zig 0.15.2, macOS)
source: https://github.com/version-next/zenit
---

# Spinner

`ui.widgets.Spinner`

A compact animation for short waits.

[Video](https://ui.surf/zenit/media/stories/spinner.mp4?v=b8738c4012)

**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`

```zig
// ── 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](https://github.com/version-next/zenit/blob/HEAD/examples/storybook/stories.zig#L638)

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.

### SpinnerProps

`ui.widgets.Spinner`

[src/ui/components/spinner/mod.zig:26](https://github.com/version-next/zenit/blob/HEAD/src/ui/components/spinner/mod.zig#L26)

```zig
fn Spinner(props: SpinnerProps) SpinnerBuilder
```

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `size` | `f32` | `20` | 外径（逻辑像素） |
| `stroke_width` | `f32` | `3` | 线宽 |
| `color` | `?Color` | `null` | 弧线颜色（null = 使用主题 accent 色） |

### \*Node

`ui.widgets.Spinner`

mount returns `*Node` directly. Append it to a parent.
