frameworkExperience & interface

Spinbutton and Numeric Input

A numeric input accepts typed numbers, while a spinbutton adds controls and keyboard behavior for stepping through a bounded or discrete numeric range.

Download Markdown (.md)

01What it means

A numeric input is a field intended for number entry and validation. A spinbutton, sometimes called a numeric stepper, combines an editable value with increment and decrement behavior, commonly through arrow keys and adjacent controls. It is distinct from a step indicator used to show progress through a flow.[1][2]

02Why it matters

Direct typing supports precision and large changes, while step controls make small bounded adjustments efficient. Defining parsing, range, units, and error behavior prevents apparently numeric values from being rounded, reformatted, or rejected unexpectedly.

03When to use it

Use a spinbutton for quantities with sensible increments and limits, such as attendee count. Use a plain text-oriented input for identifiers, postal codes, card numbers, and values where arithmetic is irrelevant, and use a slider when relative adjustment matters more than exact entry.

04How it works

  1. Determine whether the value is truly numeric and define range, step, precision, units, and empty state.
  2. Allow direct editing and provide increment and decrement controls only when stepping is useful.
  3. Expose current, minimum, maximum, invalid, and human-readable value information programmatically.
  4. Validate without blocking ordinary editing states such as a temporary minus sign or decimal separator.
  5. Test keyboard arrows, holding controls, mobile keyboards, localization, boundaries, and accidental changes.

05A practical example

Example

A hotel booking form uses a spinbutton for room count from 1 to 8. Guests can type 4 or use labeled minus and plus buttons; values above 8 produce an inline explanation, and a loyalty number remains a text input because leading zeros and arithmetic have no meaning.

06Where it breaks

Increment controls can be too small, native browser behavior varies, and scroll-wheel changes can occur accidentally. Numeric formatting and decimal rules differ by locale, while strict filtering can interfere with valid intermediate input.

Common mistakes

  • Using a numeric field for digit strings such as account or postal codes.
  • Preventing users from typing a value and forcing repeated increments.
  • Rounding or clamping silently without explaining the accepted range.
  • Confusing a numeric stepper with a multi-step progress indicator.

07Sources

  1. Spinbutton PatternW3C Web Accessibility Initiative · Technical guidanceSpinbutton Pattern
  2. Number inputCarbon Design System · Institutional design systemNumber input
View saved topics

Start typing to search titles, definitions, categories, and frameworks.