components/stepper
Actions · 07 / 64

NumberStepper

ui.widgets.NumberStepper

Precise increment and decrement for quantities and parameters.

BEHAVIOR CONTRACT

min / max / step, direct entry, disabled and the step buttons share one numeric constraint.

RECORDED INTERACTION

The harness clicks plus; the value moves by one step.

examples/storybook/stories.zig:3025
// ── NumberStepper ──
pub fn buildNumberStepper(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
    const a = cx.allocator;
    const c = try col(cx, 12);
    const ns = try ui.widgets.NumberStepper(.{ .value = 5, .min = 0, .max = 10 }, scope, cx);
    ns.wrapper.meta.ownership.meta.test_id = "story.stepper.basic";
    try c.appendChild(a, try label(cx, "0–10, step 1"));
    try c.appendChild(a, ns.wrapper);
    const ns2 = try ui.widgets.NumberStepper(.{ .value = 0.5, .step = 0.25, .width = 160 }, scope, cx);
    try c.appendChild(a, try label(cx, "step 0.25"));
    try c.appendChild(a, ns2.wrapper);
    const ns3 = try ui.widgets.NumberStepper(.{ .value = 3, .disabled = true }, scope, cx);
    try c.appendChild(a, try label(cx, "Disabled"));
    try c.appendChild(a, ns3.wrapper);
    return c;
}
View source on GitHubexamples/storybook/stories.zig:3025

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