InputNumber
Edit a constrained number with step buttons and keyboard controls.
Use InputNumber for a numeric field with step controls and constrained committed values. Choose a plain Input when free-form numeric text is required.
Basic usage#
Playground#
Anatomy#
Usage#
Values and boundaries#
Use rawValue with onRawValueChange when numeric state is application-owned; value and onValueChange expose the locale-formatted string. The component preserves partial typed input until commit, then applies minValue and maxValue. Decimal steps are calculated to avoid typical floating-point display noise.
Stepping and repeat#
In vertical layout, the input precedes an optional controls wrapper containing increment and decrement buttons. The input remains the spinbutton keyboard target.
step controls increment and decrement buttons, while largeStep controls PageUp and PageDown. Hold-to-repeat is enabled by default and can be tuned with the repeat timing props.
Keyboard interaction#
| Key | Description |
|---|---|
| ↑ | Increments the value by step. |
| ↓ | Decrements the value by step. |
| ⇞ | Increments by largeStep (defaults to step * 10). |
| ⇟ | Decrements by largeStep (defaults to step * 10). |
| ↖ | Sets the value to minValue when a minimum is defined. |
| ↘ | Sets the value to maxValue when a maximum is defined. |
| ↵ | Commits the current text input as a numeric value. |
Examples#
Controlled value#
Keyboard stepping#
Press and hold#
Form integration#
Attributes#
data-disabledSlot: input-number, input-number-input, input-number-increment, input-number-decrementDescription: Present when the component, slot, or item is disabled.data-invalidSlot: input-number, input-number-inputDescription: Present when the field or form has a validation error.data-readonlySlot: input-number, input-number-inputDescription: Present when the field is in read-only mode.data-requiredSlot: input-number, input-number-inputDescription: Present when the field input is required.data-auto-alignSlot: input-number-inputDescription: Present when alignment is selected automatically.data-activeSlot: input-number-increment, input-number-decrementDescription: Present when the item or trigger is active.Props#
Props for the InputNumber component. Renders a <div> element by default.