Skip to content
IndexRequest a UIAboutContact

Stepper with Hold to Repeat

Plus and minus buttons that repeat while held, accelerate the longer you hold, and respect minimum and maximum limits.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Clean UI mockup of a quantity stepper control, a rounded pill with a minus button on the left, a large centred number 24 in an editable field, and a plus button on the right, the plus button shown pressed with a subtle darker fill, a small caption below reading Hold to change quickly, a second state where the minus button is disabled and greyed at the minimum value 0, light theme, flat modern style. Negative: heavy shadows, gradients, text errors, clutter. Reduced motion: static design.

About this pattern

Definition

A stepper changes a number with plus and minus buttons. For wide ranges, holding a button should keep stepping, slowly at first and then faster, so people can move quickly without typing. Limits disable the buttons, and the number stays directly editable for exact values.

Purpose & UX principles

  • A single press changes by one; holding starts repeating after about 400 ms.
  • Accelerate in stages, for example every 120 ms, then every 60 ms, then every 30 ms with a larger step.
  • Stop on release, on leaving the button and at the limits.
  • Keep a number input in the middle with an accessible name and role spinbutton behaviour.

Interaction states

  • A quantity stepper from 0 to 200 with hold to repeat and editable number.

Motion specification

  • The number updates in real time while holding.
  • Reduced motion: repeat is still available because it is user-driven, but the value flash is off.

Responsive behaviour

  • Support keyboard: arrow keys step, Page Up and Page Down step by ten.
  • Announce the value change politely; avoid announcing every repeat step.

Code

HTML
<div class="bx"><div class="sp" id="sp"><button type="button" class="b" id="mn" aria-label="Decrease">−</button><input id="nv" type="text" inputmode="numeric" role="spinbutton" aria-label="Quantity" aria-valuemin="0" aria-valuemax="200" aria-valuenow="24" value="24"><button type="button" class="b" id="pl" aria-label="Increase">+</button></div><p class="out" id="out"></p></div>

Related patterns

Range Slider

↗
Range SliderInputs & Forms

Rolling Counter

↗
Rolling CounterMicro Interactions

Press Feedback

↗
Press FeedbackButtons & Actions