components/stepper
액션과 선택 · 07 / 64

NumberStepper

ui.widgets.NumberStepper

수량과 파라미터를 정밀하게 증감합니다.

BEHAVIOR CONTRACT

min / max / step, 직접 입력, 비활성 상태, 스텝 버튼이 하나의 수치 제약을 공유합니다.

RECORDED INTERACTION

harness가 플러스를 클릭하면 값이 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;
}
GitHub에서 소스 보기examples/storybook/stories.zig:3025

Storybook에 있는 이 story의 원본 코드입니다(zenit 5f9add5+wip 2026-09-30). W는 ui.widgets이며, col / row / label은 Storybook 내부의 작은 레이아웃 헬퍼입니다.

zenit · 이중 라이선스오픈 소스 프로젝트는 GPL-3.0-only로 무료 사용할 수 있으며, 비공개 소스나 상용 제품에는 상용 라이선스가 필요합니다.작성자 연락처: zongyi.xzy#gmail.com (#을 @로 바꾸세요)zenit 5f9add5+wip 2026-09-30