NumberStepper
ui.widgets.NumberStepperPräzises Erhöhen und Verringern für Mengen und Parameter.
BEHAVIOR CONTRACT
min / max / step, direkte Eingabe, disabled und die Schrittbuttons teilen sich eine numerische Einschränkung.
RECORDED INTERACTION
Der Harness klickt auf Plus; der Wert ändert sich um einen Schritt.
// ── 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;
}Der unveränderte Quellcode der Story aus dem Storybook (zenit 5f9add5+wip 2026-09-30). W steht für ui.widgets; col / row / label sind kleine Layout-Helfer des Storybooks.
NumberStepperProps
ui.widgets.NumberStepperfn mountNumberStepper(props: NumberStepperProps, scope: *Scope, cx: *Cx) !NumberStepperMountFeld
Typ
Standard
Beschreibung
valuef640—
min?f64null—
max?f64null—
stepf641—
widthf32140—
disabledboolfalse—
on_change?core.HandlerRefnull值变化后触发;caller 读 state.value
NumberStepperMount
ui.widgets.NumberStepperFeld
Typ
Standard
Beschreibung
wrapper*Node—
—
state*NumberStepperState—
—