Number input

A number field (Mantine's NumberInput): + and − buttons (hold to repeat), arrow keys, min, max and step, fixed decimals, a prefix and a suffix, a thousands separator, or a duration (m:ss). An ARIA spinbutton.

Source on GitHub

An order: quantity × price
Subtotal
Discount
Total

Arrows step, Shift+arrows ×10, hold + or − to repeat.

Units, steps and locales
Durations: format="duration"
Clamping, states and variants
Code

API

For AI agents: this API as Markdown, or every component in llms-full.txt.

<ray-number-input> · RayNumberInput

Arrow Up/Down step (Shift: ×10), Page Up/Down ×10, Home/End go to min/max. The value is a number (undefined when empty); the form gets its plain digits; min and max are checked (rangeUnderflow, rangeOverflow). Enter submits its form, as in ray-input.

PropertyAttributeTypeDefaultDescription
valuevaluenumberThe number (undefined when empty).
minminnumberMinimum.
maxmaxnumberMaximum.
stepstepnumber1What + and − add.
decimalsdecimalsnumberFixed decimals (2: 3 shows as 3.00).
prefixprefixstringShown before the number ("$"), beside the editable text: the field holds the digits only. Still in aria-valuetext and in the min/max messages.
suffixsuffixstringShown after the number (" kg", "%"), hugging it on the other side of the caret: the field holds the digits only.
thousandsSeparatorthousands-separatorstringGroups thousands in the shown text (",", ".", " ").
decimalSeparatordecimal-separatorstring.The decimal mark shown and typed ("," in many locales).
clampclampblur | strict | noneblurWhen out-of-range input is clamped: on blur, while typing, or never (then it is invalid).
formatformat reflectsnumber | durationnumberduration: the value is seconds, shown and typed as m:ss (h:mm:ss when min or max reaches an hour; a plain number is seconds); aria-valuetext says "3 minutes, 15 seconds" in the page's language. decimals, prefix, suffix and the separators do not apply.
hideControlshide-controls reflectsbooleanNo + and − buttons (the keys still step).
placeholderplaceholderstringShown while empty.
readonlyreadonly reflectsbooleanNot editable, still submitted.
EventDescription
inputOn every change of the value (typing, keys, buttons).
changeWhen the value is committed (blur, a step).
SlotDescription
leftLeft section (an icon).
rightRight section.
PartDescription
inputThe text field.
prefixThe prefix beside the text field.
suffixThe suffix beside the text field.
controlsThe + and − column.
incrementThe + button.
decrementThe − button.

Texts

What it writes itself, in English; setStrings() translates them (Getting started: Languages).

KeyEnglish
number-input.incrementIncrement
number-input.decrementDecrement
number-input.requiredPlease enter a number.
number-input.minThe minimum is {min}.
number-input.maxThe maximum is {max}.