If true, the input's value will change based on mouse wheel
Number Input
The NumberInput component is similar to the Input component, but it has controls for incrementing or decrementing numeric values.
Props#
NumberInput Props#
NumberInput composes Flex with some additional props listed below.
allowMouseWheel
allowMouseWheelbooleanaria-describedby
aria-describedbystringaria-label
aria-labelstringaria-labelledby
aria-labelledbystringclampValueOnBlur
clampValueOnBlurThis controls the value update when you blur out of the input.
- If true and the value is greater than max, the value will be reset to max
- Else, the value remains the same.
booleantruecolorScheme
colorSchemeColor Schemes for NumberInput are not implemented in the default theme. You can extend the theme to implement them.
stringdefaultValue
defaultValueThe initial value of the counter. Should be less than max and greater than min
string | numbererrorBorderColor
errorBorderColorThe border color when the input is invalid. Use color keys in `theme.colors` @example errorBorderColor = "red.500"
stringfocusBorderColor
focusBorderColorThe border color when the input is focused. Use color keys in `theme.colors` @example focusBorderColor = "blue.500"
stringfocusInputOnChange
focusInputOnChangeIf true, the input will be focused as you increment
or decrement the value with the stepper
booleantrueformat
formatIf using a custom display format, this converts the default format to the custom format.
((value: string | number) => string | number)getAriaValueText
getAriaValueTextThis is used to format the value so that screen readers can speak out a more human-friendly value. It is used to set the `aria-valuetext` property of the input
((value: string | number) => string)id
idThe id to use for the number input field.
stringinputMode
inputModeHints at the type of data that might be entered by the user. It also determines the type of keyboard shown to the user on mobile devices
"text" | "search" | "none" | "tel" | "url" | "email" | "numeric" | "decimal""decimal"isDisabled
isDisabledWhether the input should be disabled
booleanisInvalid
isInvalidIf true, the input will have `aria-invalid` set to true
booleanisReadOnly
isReadOnlyIf true, the input will be in readonly mode
booleanisRequired
isRequiredWhether the input is required
booleanisValidCharacter
isValidCharacterWhether the pressed key should be allowed in the input. The default behavior is to allow DOM floating point characters defined by /^[Ee0-9+\-.]$/
((value: string) => boolean)keepWithinRange
keepWithinRangeThis controls the value update behavior in general.
- If true and you use the stepper or up/down arrow keys,
the value will not exceed the max or go lower than min
- If false, the value will be allowed to go out of range.
booleantruemax
maxThe maximum value of the counter
numberNumber.MAX_SAFE_INTEGERmin
minThe minimum value of the counter
numberNumber.MIN_SAFE_INTEGERname
nameThe HTML name attribute used for forms
stringonBlur
onBlurFocusEventHandler<HTMLInputElement>onChange
onChangeThe callback fired when the value changes
((valueAsString: string, valueAsNumber: number) => void)onFocus
onFocusFocusEventHandler<HTMLInputElement>onInvalid
onInvalid((message: ValidityState, value: string, valueAsNumber: number) => void)parse
parseIf using a custom display format, this converts the custom format to a format parseFloat understands.
((value: string) => string)pattern
patternThe pattern used to check the <input> element's value against on form submission.
string"[0-9]*(.[0-9]+)?"precision
precisionThe number of decimal points used to round the value
numbersize
size"xs" | "sm" | "md" | "lg""md"step
stepThe step used to increment or decrement the value
number1value
valueThe value of the counter. Should be less than max and greater than min
string | numbervariant
variant"outline" | "filled" | "flushed" | "unstyled""outline"NumberInputField Props#
NumberInputField composes Input so you can pass all Input props. If you
want to change the size, pass the size prop to the NumberInput component
instead, as demonstrated above.
NumberInputStepper Props#
NumberInputStepper composes Flex so you can pass all Flex props.
NumberDecrementStepper and NumberIncrementStepper Props#
NumberDecrementStepper and NumberIncrementStepper composes the Box props
so you can pass all Box props.
Props#
NumberInput Props#
NumberInput composes Flex with some additional props listed below.
allowMouseWheel
allowMouseWheelIf true, the input's value will change based on mouse wheel
booleanaria-describedby
aria-describedbystringaria-label
aria-labelstringaria-labelledby
aria-labelledbystringclampValueOnBlur
clampValueOnBlurThis controls the value update when you blur out of the input.
- If true and the value is greater than max, the value will be reset to max
- Else, the value remains the same.
booleantruecolorScheme
colorSchemeColor Schemes for NumberInput are not implemented in the default theme. You can extend the theme to implement them.
stringdefaultValue
defaultValueThe initial value of the counter. Should be less than max and greater than min
string | numbererrorBorderColor
errorBorderColorThe border color when the input is invalid. Use color keys in `theme.colors` @example errorBorderColor = "red.500"
stringfocusBorderColor
focusBorderColorThe border color when the input is focused. Use color keys in `theme.colors` @example focusBorderColor = "blue.500"
stringfocusInputOnChange
focusInputOnChangeIf true, the input will be focused as you increment
or decrement the value with the stepper
booleantrueformat
formatIf using a custom display format, this converts the default format to the custom format.
((value: string | number) => string | number)getAriaValueText
getAriaValueTextThis is used to format the value so that screen readers can speak out a more human-friendly value. It is used to set the `aria-valuetext` property of the input
((value: string | number) => string)id
idThe id to use for the number input field.
stringinputMode
inputModeHints at the type of data that might be entered by the user. It also determines the type of keyboard shown to the user on mobile devices
"text" | "search" | "none" | "tel" | "url" | "email" | "numeric" | "decimal""decimal"isDisabled
isDisabledWhether the input should be disabled
booleanisInvalid
isInvalidIf true, the input will have `aria-invalid` set to true
booleanisReadOnly
isReadOnlyIf true, the input will be in readonly mode
booleanisRequired
isRequiredWhether the input is required
booleanisValidCharacter
isValidCharacterWhether the pressed key should be allowed in the input. The default behavior is to allow DOM floating point characters defined by /^[Ee0-9+\-.]$/
((value: string) => boolean)keepWithinRange
keepWithinRangeThis controls the value update behavior in general.
- If true and you use the stepper or up/down arrow keys,
the value will not exceed the max or go lower than min
- If false, the value will be allowed to go out of range.
booleantruemax
maxThe maximum value of the counter
numberNumber.MAX_SAFE_INTEGERmin
minThe minimum value of the counter
numberNumber.MIN_SAFE_INTEGERname
nameThe HTML name attribute used for forms
stringonBlur
onBlurFocusEventHandler<HTMLInputElement>onChange
onChangeThe callback fired when the value changes
((valueAsString: string, valueAsNumber: number) => void)onFocus
onFocusFocusEventHandler<HTMLInputElement>onInvalid
onInvalid((message: ValidityState, value: string, valueAsNumber: number) => void)parse
parseIf using a custom display format, this converts the custom format to a format parseFloat understands.
((value: string) => string)pattern
patternThe pattern used to check the <input> element's value against on form submission.
string"[0-9]*(.[0-9]+)?"precision
precisionThe number of decimal points used to round the value
numbersize
size"xs" | "sm" | "md" | "lg""md"step
stepThe step used to increment or decrement the value
number1value
valueThe value of the counter. Should be less than max and greater than min
string | numbervariant
variant"outline" | "filled" | "flushed" | "unstyled""outline"NumberInputField Props#
NumberInputField composes Input so you can pass all Input props. If you
want to change the size, pass the size prop to the NumberInput component
instead, as demonstrated above.
NumberInputStepper Props#
NumberInputStepper composes Flex so you can pass all Flex props.
NumberDecrementStepper and NumberIncrementStepper Props#
NumberDecrementStepper and NumberIncrementStepper composes the Box props
so you can pass all Box props.