본문 바로가기
명함 만들기 캐릭터 모음 16가지 디자인 · PNG / SVG / PDF

숫자 스테퍼

한두 번 눌러 끝나는 작은 수 — 수량, 인원, 일수처럼 1씩 오르내리는 값.

입력

실제 미리보기

출처

<div class="dc-stp">
  <label class="dc-stp__label" for="dc-stp-qty">수량</label>
  <div class="dc-stp__group">
    <button class="dc-stp__btn" type="button"><span class="dc-sr">한 개 줄이기</span><span aria-hidden="true">−</span></button>
    <input class="dc-stp__input" id="dc-stp-qty" type="number" name="qty" inputmode="numeric" value="2" min="1" max="99" step="1" aria-describedby="dc-stp-qty-help">
    <button class="dc-stp__btn" type="button"><span class="dc-sr">한 개 늘리기</span><span aria-hidden="true">+</span></button>
  </div>
  <p class="dc-stp__help" id="dc-stp-qty-help">한 번에 99개까지 담을 수 있습니다.</p>
</div>
.dc-stp {
  display: flex; flex-direction: column; gap: var(--dc-2);
  font-family: var(--dc-font);
}
.dc-stp__label { font-size: 14px; font-weight: 600; color: var(--dc-text); }
.dc-stp__group {
  display: inline-flex; align-items: stretch; align-self: flex-start;
  border: 1px solid var(--dc-line-field); border-radius: var(--dc-r-sm);
  background: var(--dc-surface); overflow: hidden;
}
.dc-stp__group:focus-within {
  border-color: var(--dc-brand); box-shadow: 0 0 0 3px var(--dc-brand-soft);
}
.dc-stp__btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; min-height: 44px;
  border: 0; background: var(--dc-surface); color: var(--dc-text);
  font-family: inherit; font-size: 20px; font-weight: 600; line-height: 1;
  transition: background var(--dc-fast);
}
.dc-stp__btn:hover { background: var(--dc-sunken); }
.dc-stp__btn:disabled { background: var(--dc-sunken); color: var(--dc-text-mute); cursor: not-allowed; }
.dc-stp__input {
  width: 56px; min-height: 44px; padding: 0 var(--dc-1);
  border: 0; border-left: 1px solid var(--dc-line); border-right: 1px solid var(--dc-line);
  background: var(--dc-surface); color: var(--dc-text);
  font-family: var(--dc-mono); font-size: 16px; text-align: center;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.dc-stp__input:focus { outline: none; }
.dc-stp__input::-webkit-outer-spin-button,
.dc-stp__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dc-stp__input[disabled] { background: var(--dc-sunken); color: var(--dc-text-mute); cursor: not-allowed; }
.dc-stp__unit {
  display: inline-flex; align-items: center; padding: 0 var(--dc-3);
  border-right: 1px solid var(--dc-line);
  background: var(--dc-sunken); color: var(--dc-text-sub);
  font-size: 14px; white-space: nowrap;
}
.dc-stp__help { margin: 0; font-size: 13px; line-height: 1.5; color: var(--dc-text-sub); }

이렇게 씁니다

  • 직접 타이핑도 되게 둔다 — 30개를 담으려고 버튼을 서른 번 누르게 하지 않는다
  • 최소·최대에 닿으면 그 버튼을 비활성으로 바꿔 끝이라는 것을 보여 준다
  • 100을 넘는 값이나 자유로운 수는 스테퍼가 아니라 숫자 입력칸으로 받는다

주의할 점

  • 버튼은 44×44px 이상으로 — 좁히면 옆 버튼을 잘못 누른다
  • 아이콘만 있는 버튼에는 이름을 넣는다. "+"만 두면 스크린리더가 "더하기"로만 읽는다

다음에 볼 것