Stepper input
A tactile incrementer: tap to step, hold to accelerate, bounds give an elastic bumper shake, and digits roll in place.
Used forBilling & seatsCanvas & design inspectorsE-commerce cartsModel parameters
Install with the shadcn CLI
Older shadcn CLI, or a network that blocks ui.shadcn.com? Install by URL: shadcn add https://hairlineui.com/r/stepper-input.json. More
Used in 3 blocks
All blocks- Pricing plansPlans that turn into their own checkout: pick one and its card becomes the order, seats and totals rolling, then Continue opens your checkout.
- CartA cart whose receipt does the maths in front of you: codes are stamped on, a rail of light fills toward free shipping and every total rolls.
- Buy boxA product buy box whose swatches repaint the product: pick a colour and size, and Add to bag throws the product into the bag.
Templates
Need the whole page?
65 Next.js landing pages, each designed from scratch. Try any of them live; one is $39, all of them $159, and 8 are free.
Where it’s used
Billing & seats
Adjust workspace licenses or team member counts with immediate price calculations.
Canvas & design inspectors
Nudge padding, border-radius, font size, or opacity with hold-to-accelerate speed.
E-commerce carts
Quantity steppers that prevent zero-quantity mistakes and clamp to warehouse inventory.
Model parameters
Tune temperature, top-p, and context window limits with fine-grained decimal steps.
What it handles for you
Building a custom number stepper seems trivial until you need hold-to-accelerate timing, bound checking, keyboard arrow accessibility, decimal precision rounding, and seamless direct text editing. This handles all of it.
Odometer roll direction
Increments roll upward and decrements roll downward through NumberRoll, maintaining continuous directional feedback.
Exponential hold acceleration
Holds start with a 300ms delay to prevent accidental runs, then step at 90ms, 55ms, and 30ms with automatic 5x/10x multipliers.
Elastic bumper feedback
Hitting the min or max bound produces a brief horizontal elastic shake rather than dead-ending without feedback.
Direct editing in place
Clicking the number reveals a full input without shifting a pixel; Enter or blur parses, clamps, and commits.
Floating-point precision
Handles fractional steps like 0.1 or 0.05 without standard JavaScript floating-point artifacts like 0.30000000000000004.
Accessible spinbutton
Supports ArrowUp/Down, PageUp/Down for large steps, and Home/End for boundary limits, with polite screen-reader announcements.
Overview
Number inputs usually force manual typing or rely on tiny browser stepper arrows that ignore your theme and lack feel. This is a tactile hairline stepper: single taps roll the odometer in the direction of change; holding down a button begins with a measured 300ms pause before accelerating smoothly down to 30ms intervals with scaled steps. Reaching min or max limits disables the trigger and produces an elastic bumper shake. Clicking the middle opens a clean inline input that parses, clamps, and commits on blur or Enter.
States
- rest
- Hairline pill or field container in rest state. Decrement and increment buttons display quiet icons with disabled styling when at bounds.
- tap
- Single tap or click advances by one step. The digit rolls in the direction the value changed over 260ms.
- accelerate
- Holding down past 300ms activates rapid stepping, ramping up to 30ms tick intervals with large-step multipliers.
- limit shake
- Attempting to step past min or max triggers an elastic bumper shake (±3px over 280ms) and disables the button.
- direct edit
- Clicking the value swaps the odometer for an active text input; Escape cancels back to original value, Enter commits clamped number.
Usage
Works with
Installs with it
Built on it
- Pricing plansPlans that turn into their own checkout: pick one and its card becomes the order, seats and totals rolling, then Continue opens your checkout.
- CartA cart whose receipt does the maths in front of you: codes are stamped on, a rail of light fills toward free shipping and every total rolls.
- Buy boxA product buy box whose swatches repaint the product: pick a colour and size, and Add to bag throws the product into the bag.
Team seat checkout with live pricing
StepperInput controls team seat allocation with minimum and maximum thresholds. Value updates roll instantly and feed directly into cost calculation.
Props
- label
- string
- Accessible name for the stepper, announced to assistive technologies.
- value
- number
- The controlled numeric value.
- defaultValue= 0
- number
- Initial numeric value when uncontrolled.
- onValueChange
- (value: number) => void
- Callback invoked when the value changes.
- min= -Infinity
- number
- Minimum allowed value.
- max= Infinity
- number
- Maximum allowed value.
- step= 1
- number
- Amount to increment or decrement on single steps.
- largeStep
- number
- Step multiplier for PageUp/PageDown and sustained acceleration (defaults to step * 10).
- unit
- string
- Optional text suffix displayed beside the value (e.g. "seats", "px", "%").
- format
- Intl.NumberFormatOptions
- Formatting options forwarded to NumberRoll.
- variant= "pill"
- "pill" | "field"
- Border radius style: pill (rounded-full) or field (rounded-lg).
- size= "default"
- "sm" | "default"
- Control height and typography size: sm (28px) or default (36px).
- disabled= false
- boolean
- Disables all interactions and dims the control.
- name
- string
- Name attribute for hidden input submitted with HTML forms.
Accessibility and motion
- Uses NumberRoll internally so numbers roll in the exact direction of travel (increment rolls up, decrement rolls down).
- Hold-to-accelerate uses touch-safe pointer listeners and clears all timers on pointer cancel or unmount.
- Arrow keys, PageUp/PageDown, and Home/End support the full WAI-ARIA spinbutton specification.
- Direct text edit automatically clamps and rounds to the specified step precision to eliminate floating-point arithmetic errors.
- Reduced motion replaces the bumper shake and roll animations with instant updates.
Requirements
React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.
The CLI also installs Number roll.
Source
Registry item: /r/stepper-input.json


