NumberStepper
ui.widgets.NumberStepper수량과 파라미터를 정밀하게 증감합니다.
BEHAVIOR CONTRACT
min / max / step, 직접 입력, 비활성 상태, 스텝 버튼이 하나의 수치 제약을 공유합니다.
RECORDED INTERACTION
harness가 플러스를 클릭하면 값이 step만큼 바뀝니다.
// ── 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;
}Storybook에 있는 이 story의 원본 코드입니다(zenit 5f9add5+wip 2026-09-30). W는 ui.widgets이며, col / row / label은 Storybook 내부의 작은 레이아웃 헬퍼입니다.
NumberStepperProps
ui.widgets.NumberStepperfn mountNumberStepper(props: NumberStepperProps, scope: *Scope, cx: *Cx) !NumberStepperMount필드
타입
기본값
설명
valuef640—
min?f64null—
max?f64null—
stepf641—
widthf32140—
disabledboolfalse—
on_change?core.HandlerRefnull值变化后触发;caller 读 state.value
NumberStepperMount
ui.widgets.NumberStepper필드
타입
기본값
설명
wrapper*Node—
—
state*NumberStepperState—
—