Skip to content

NumberInput

Props

API reference for NumberInput. For usage examples, see the React tab.

NumberInput

NameTypeDefault
alignment"left" | "right"left

Sets the alignment of the value in the input

childrenChildrenOrFunction<NumberFieldRenderProps>

The children of the component. A function may be provided to alter the children based on component state.

commitBehavior"snap" | "validate"'snap'

Controls the behavior of the number field when the user blurs the field after editing. 'snap' will clamp the value to the min/max values, and snap to the nearest step value. 'validate' will not clamp the value, and will validate that the value is within the min/max range and on a valid step.

decrementAriaLabelstring

A custom aria-label for the decrement button. If not provided, the localized string "Decrement" is used.

descriptionstring

Adds a description to the input.

formatOptionsNumberFormatOptions

Formatting options for the value displayed in the number field. This also affects what characters are allowed to be typed by the user.

incrementAriaLabelstring

A custom aria-label for the increment button. If not provided, the localized string "Increment" is used.

isDisabledboolean

Whether the input is disabled.

isInvalidboolean

Whether the input value is invalid.

isReadOnlyboolean

Whether the input can be selected but not changed by the user.

isRequiredbooleanfalse

Sets the input to a required state.

isWheelDisabledboolean

Enables or disables changing the value with scroll.

labelstring

Adds label for the input.

maxValuenumber

The largest value allowed for the input.

minValuenumber

The smallest value allowed for the input.

size"lg" | "md" | "sm""md"

Controls height, padding, and typography of the input.

compactDeprecatedboolean

Use size instead. This prop is a no-op.

NumberField

NameTypeDefault
childrenChildrenOrFunction<NumberFieldRenderProps>

The children of the component. A function may be provided to alter the children based on component state.

commitBehavior"snap" | "validate"'snap'

Controls the behavior of the number field when the user blurs the field after editing. 'snap' will clamp the value to the min/max values, and snap to the nearest step value. 'validate' will not clamp the value, and will validate that the value is within the min/max range and on a valid step.

decrementAriaLabelstring

A custom aria-label for the decrement button. If not provided, the localized string "Decrement" is used.

formatOptionsNumberFormatOptions

Formatting options for the value displayed in the number field. This also affects what characters are allowed to be typed by the user.

incrementAriaLabelstring

A custom aria-label for the increment button. If not provided, the localized string "Increment" is used.

isDisabledboolean

Whether the input is disabled.

isInvalidboolean

Whether the input value is invalid.

isReadOnlyboolean

Whether the input can be selected but not changed by the user.

isRequiredboolean

Whether user input is required on the input before form submission.

isWheelDisabledboolean

Enables or disables changing the value with scroll.

maxValuenumber

The largest value allowed for the input.

minValuenumber

The smallest value allowed for the input.