NumberInput
v1.0.3Updated 20 Jul 2026Numeric spinbutton field with min/max clamping, step increments (keyboard + hold-to-repeat stepper buttons) and Intl.NumberFormat display when blurred — decimal, currency (default THB) or percent. Shows the raw editable
Preview
Live · 12 stories▸Why this is recommendednumberspinbuttonsteppercurrency+5
The default, out-of-the-box NumberInput.
- ✓Invoice quantities and unit prices (THB)
- ✓VAT / discount percentage fields
- ✓Stock reorder levels
- ✓Any bounded numeric entry
- Controlled (value/onValueChange) and uncontrolled (defaultValue) modes, null = empty
- min / max clamping on blur and on every step
- step increments with hold-to-repeat stepper buttons
- Keyboard: ArrowUp/Down = step, PageUp/Down = 10x step, Home/End = min/max
- precision rounding without floating-point residue
- Intl formats: 'decimal' | 'currency' (currency prop, default THB) | 'percent' (value 7 renders 7%)
- Locale prop (default th-TH)
- prefix / suffix adornments
- role=spinbutton with aria-valuenow / valuemin / valuemax / valuetext
- disabled / readOnly / error states, sizes sm / default / lg
- Hidden input carries the raw number for form submission when name is set
- i18n: labels prop overrides the stepper aria-labels
- ✕Free-form text (use Input)
- ✕Continuous ranges with visual feedback (use Slider)
- ✕Phone numbers or IDs (use InputMask)
Install
Ask your agent, or call the MCP tool directly. The resolved bundle is written into your project.
Usage
Tick variants in the left menu — each adds a tab with that variant’s real story source, the same code the preview above renders.
Props
valueControlled value; null = empty
—defaultValueUncontrolled initial value
—onValueChangeFires with the parsed number
—minLower clamp bound
—maxUpper clamp bound
—stepIncrement for arrows/steppers (default 1)
—precisionDecimal places rounded to on commit
—formatBlurred display format
—currencyISO 4217 code for currency format (default THB)
—localeBCP 47 locale (default th-TH)
—prefixLeading in-field adornment
—suffixTrailing in-field adornment
—showSteppersShow up/down buttons (default true)
—sizeField size
—labelField label
—hintHelper text below the field
—errorError message; flips invalid styling
—labelsOverride built-in UI strings (i18n)
—