Skip to content

NumberInput

Numeric input field with optional min/max bounds and step control.

function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />

Wheel disabled (default): scrolling over the focused input scrolls this panel.

Wheel enabled: scrolling over the focused input changes its value.

function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<div className={wheelStoryStyles.grid}>
<div className={wheelStoryStyles.panel}>
<p className={wheelStoryStyles.text}>
Wheel disabled (default): scrolling over the focused input scrolls
this panel.
</p>
<div className={wheelStoryStyles.scrollArea}>
<div className={wheelStoryStyles.spacer} />
<ControlledNumberInput label="Wheel disabled" value={2} />
<div className={wheelStoryStyles.spacer} />
</div>
</div>
<div className={wheelStoryStyles.panel}>
<p className={wheelStoryStyles.text}>
Wheel enabled: scrolling over the focused input changes its value.
</p>
<div className={wheelStoryStyles.scrollArea}>
<div className={wheelStoryStyles.spacer} />
<ControlledNumberInput
isWheelEnabled
label="Wheel enabled"
value={2}
/>
<div className={wheelStoryStyles.spacer} />
</div>
</div>
</div>
GB
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<div style={{display: 'flex', flexDirection: 'column', gap: 16}}>
<ControlledNumberInput label="Small" size="sm" value={10} />
<ControlledNumberInput label="Medium" size="md" value={20} />
<ControlledNumberInput label="Large" size="lg" value={30} />
</div>
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />
Value is unusually high
Value is valid
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<div style={{display: 'flex', flexDirection: 'column', gap: 16}}>
<ControlledNumberInput
label="Error"
status={{message: 'Value is out of range', type: 'error'}}
value={999}
/>
<ControlledNumberInput
label="Warning"
status={{message: 'Value is unusually high', type: 'warning'}}
value={95}
/>
<ControlledNumberInput
label="Success"
status={{message: 'Value is valid', type: 'success'}}
value={50}
/>
</div>
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />
Enter a value between 1 and 100
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />
USD
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />
function ControlledNumberInput({
value: initialValue = null,
...args
}: ControlledNumberInputProps): React.JSX.Element {
const [value, setValue] = useState<number | null>(initialValue);
return (
<NumberInput
{...(args as NumberInputProps)}
onChange={setValue}
value={value}
/>
);
}
<ControlledNumberInput {...args} />

Numeric input field with optional min/max bounds and step control.

When isOptional: false, isRequired: false, hasClear: true

PropTypeDefaultDescription
autoCompletestring—HTML autocomplete attribute value.
classNamestring—Additional CSS class names applied to the field root, or to the input wrapper when the input is inside an InputGroup.
data-testidstring—Test ID applied to the input element.
descriptionReactNode—Supporting text displayed below the label.
endContentReactNode—Content rendered after the input, before the status icon.
hasAutoFocusbooleanfalseWhether to focus the input on mount.
htmlNamestring—HTML name attribute.
isDisabledbooleanfalseWhether the input is disabled.
isReadOnlybooleanfalseWhether the value is displayed without allowing focus or interaction.
isIntegerOnlybooleanfalseWhether to restrict input to integer values only.
isWheelEnabledbooleanfalseWhether scrolling the mouse wheel over the focused input changes its value.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
label*string—Field label.
labelEndReactNode—Content shown at the end of the label row, such as a link. It renders outside the label, so it does not focus the control or change its accessible name. It stays visible when isLabelHidden is true.
labelIconIconComponent—Icon rendered beside the label.
labelTooltipReactNode—Tooltip content shown next to the label.
maxnumber | null—Maximum allowed value.
minnumber | null—Minimum allowed value.
onBlur(event: FocusEvent<HTMLInputElement>) => void—Called when the input loses focus.
onEnter() => void—Called when Enter is pressed.
onFocus(event: FocusEvent<HTMLInputElement>) => void—Called when the input receives focus.
onKeyDown(event: KeyboardEvent<HTMLInputElement>) => void—Keyboard event handler for the input.
placeholderstring—Placeholder text.
refRef<HTMLInputElement>—Ref forwarded to the input element.
size"sm" | "md" | "lg"'md'Visual size.
startIconIconComponent—Icon shown before the input.
statusInputStatus—Validation status displayed below the input.
stepnumber | null—Step increment for the number input.
styleCSSProperties—Inline styles applied to the field root, or to the input wrapper when the input is inside an InputGroup.
unitsstring | null—Unit label displayed after the input value.
value*number | null—Controlled numeric value.
isOptionalfalse—
isRequiredfalse—
hasClear*true—Whether to show a clear button.
onChange*(value: number | null) => void—Called when the numeric value changes or is cleared.

When isOptional: true, isRequired: false, hasClear: true

PropTypeDefaultDescription
autoCompletestring—HTML autocomplete attribute value.
classNamestring—Additional CSS class names applied to the field root, or to the input wrapper when the input is inside an InputGroup.
data-testidstring—Test ID applied to the input element.
descriptionReactNode—Supporting text displayed below the label.
endContentReactNode—Content rendered after the input, before the status icon.
hasAutoFocusbooleanfalseWhether to focus the input on mount.
htmlNamestring—HTML name attribute.
isDisabledbooleanfalseWhether the input is disabled.
isReadOnlybooleanfalseWhether the value is displayed without allowing focus or interaction.
isIntegerOnlybooleanfalseWhether to restrict input to integer values only.
isWheelEnabledbooleanfalseWhether scrolling the mouse wheel over the focused input changes its value.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
label*string—Field label.
labelEndReactNode—Content shown at the end of the label row, such as a link. It renders outside the label, so it does not focus the control or change its accessible name. It stays visible when isLabelHidden is true.
labelIconIconComponent—Icon rendered beside the label.
labelTooltipReactNode—Tooltip content shown next to the label.
maxnumber | null—Maximum allowed value.
minnumber | null—Minimum allowed value.
onBlur(event: FocusEvent<HTMLInputElement>) => void—Called when the input loses focus.
onEnter() => void—Called when Enter is pressed.
onFocus(event: FocusEvent<HTMLInputElement>) => void—Called when the input receives focus.
onKeyDown(event: KeyboardEvent<HTMLInputElement>) => void—Keyboard event handler for the input.
placeholderstring—Placeholder text.
refRef<HTMLInputElement>—Ref forwarded to the input element.
size"sm" | "md" | "lg"'md'Visual size.
startIconIconComponent—Icon shown before the input.
statusInputStatus—Validation status displayed below the input.
stepnumber | null—Step increment for the number input.
styleCSSProperties—Inline styles applied to the field root, or to the input wrapper when the input is inside an InputGroup.
unitsstring | null—Unit label displayed after the input value.
value*number | null—Controlled numeric value.
isOptional*true—
isRequiredfalse—
hasClear*true—Whether to show a clear button.
onChange*(value: number | null) => void—Called when the numeric value changes or is cleared.

When isOptional: false, isRequired: true, hasClear: true

PropTypeDefaultDescription
autoCompletestring—HTML autocomplete attribute value.
classNamestring—Additional CSS class names applied to the field root, or to the input wrapper when the input is inside an InputGroup.
data-testidstring—Test ID applied to the input element.
descriptionReactNode—Supporting text displayed below the label.
endContentReactNode—Content rendered after the input, before the status icon.
hasAutoFocusbooleanfalseWhether to focus the input on mount.
htmlNamestring—HTML name attribute.
isDisabledbooleanfalseWhether the input is disabled.
isReadOnlybooleanfalseWhether the value is displayed without allowing focus or interaction.
isIntegerOnlybooleanfalseWhether to restrict input to integer values only.
isWheelEnabledbooleanfalseWhether scrolling the mouse wheel over the focused input changes its value.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
label*string—Field label.
labelEndReactNode—Content shown at the end of the label row, such as a link. It renders outside the label, so it does not focus the control or change its accessible name. It stays visible when isLabelHidden is true.
labelIconIconComponent—Icon rendered beside the label.
labelTooltipReactNode—Tooltip content shown next to the label.
maxnumber | null—Maximum allowed value.
minnumber | null—Minimum allowed value.
onBlur(event: FocusEvent<HTMLInputElement>) => void—Called when the input loses focus.
onEnter() => void—Called when Enter is pressed.
onFocus(event: FocusEvent<HTMLInputElement>) => void—Called when the input receives focus.
onKeyDown(event: KeyboardEvent<HTMLInputElement>) => void—Keyboard event handler for the input.
placeholderstring—Placeholder text.
refRef<HTMLInputElement>—Ref forwarded to the input element.
size"sm" | "md" | "lg"'md'Visual size.
startIconIconComponent—Icon shown before the input.
statusInputStatus—Validation status displayed below the input.
stepnumber | null—Step increment for the number input.
styleCSSProperties—Inline styles applied to the field root, or to the input wrapper when the input is inside an InputGroup.
unitsstring | null—Unit label displayed after the input value.
value*number | null—Controlled numeric value.
isOptionalfalse—
isRequired*true—
hasClear*true—Whether to show a clear button.
onChange*(value: number | null) => void—Called when the numeric value changes or is cleared.

When isOptional: false, isRequired: false, hasClear: false

PropTypeDefaultDescription
autoCompletestring—HTML autocomplete attribute value.
classNamestring—Additional CSS class names applied to the field root, or to the input wrapper when the input is inside an InputGroup.
data-testidstring—Test ID applied to the input element.
descriptionReactNode—Supporting text displayed below the label.
endContentReactNode—Content rendered after the input, before the status icon.
hasAutoFocusbooleanfalseWhether to focus the input on mount.
htmlNamestring—HTML name attribute.
isDisabledbooleanfalseWhether the input is disabled.
isReadOnlybooleanfalseWhether the value is displayed without allowing focus or interaction.
isIntegerOnlybooleanfalseWhether to restrict input to integer values only.
isWheelEnabledbooleanfalseWhether scrolling the mouse wheel over the focused input changes its value.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
label*string—Field label.
labelEndReactNode—Content shown at the end of the label row, such as a link. It renders outside the label, so it does not focus the control or change its accessible name. It stays visible when isLabelHidden is true.
labelIconIconComponent—Icon rendered beside the label.
labelTooltipReactNode—Tooltip content shown next to the label.
maxnumber | null—Maximum allowed value.
minnumber | null—Minimum allowed value.
onBlur(event: FocusEvent<HTMLInputElement>) => void—Called when the input loses focus.
onEnter() => void—Called when Enter is pressed.
onFocus(event: FocusEvent<HTMLInputElement>) => void—Called when the input receives focus.
onKeyDown(event: KeyboardEvent<HTMLInputElement>) => void—Keyboard event handler for the input.
placeholderstring—Placeholder text.
refRef<HTMLInputElement>—Ref forwarded to the input element.
size"sm" | "md" | "lg"'md'Visual size.
startIconIconComponent—Icon shown before the input.
statusInputStatus—Validation status displayed below the input.
stepnumber | null—Step increment for the number input.
styleCSSProperties—Inline styles applied to the field root, or to the input wrapper when the input is inside an InputGroup.
unitsstring | null—Unit label displayed after the input value.
value*number | null—Controlled numeric value.
isOptionalfalse—
isRequiredfalse—
hasClearfalse—Whether to show a clear button.
onChange*(value: number) => void—Called when the numeric value changes.

When isOptional: true, isRequired: false, hasClear: false

PropTypeDefaultDescription
autoCompletestring—HTML autocomplete attribute value.
classNamestring—Additional CSS class names applied to the field root, or to the input wrapper when the input is inside an InputGroup.
data-testidstring—Test ID applied to the input element.
descriptionReactNode—Supporting text displayed below the label.
endContentReactNode—Content rendered after the input, before the status icon.
hasAutoFocusbooleanfalseWhether to focus the input on mount.
htmlNamestring—HTML name attribute.
isDisabledbooleanfalseWhether the input is disabled.
isReadOnlybooleanfalseWhether the value is displayed without allowing focus or interaction.
isIntegerOnlybooleanfalseWhether to restrict input to integer values only.
isWheelEnabledbooleanfalseWhether scrolling the mouse wheel over the focused input changes its value.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
label*string—Field label.
labelEndReactNode—Content shown at the end of the label row, such as a link. It renders outside the label, so it does not focus the control or change its accessible name. It stays visible when isLabelHidden is true.
labelIconIconComponent—Icon rendered beside the label.
labelTooltipReactNode—Tooltip content shown next to the label.
maxnumber | null—Maximum allowed value.
minnumber | null—Minimum allowed value.
onBlur(event: FocusEvent<HTMLInputElement>) => void—Called when the input loses focus.
onEnter() => void—Called when Enter is pressed.
onFocus(event: FocusEvent<HTMLInputElement>) => void—Called when the input receives focus.
onKeyDown(event: KeyboardEvent<HTMLInputElement>) => void—Keyboard event handler for the input.
placeholderstring—Placeholder text.
refRef<HTMLInputElement>—Ref forwarded to the input element.
size"sm" | "md" | "lg"'md'Visual size.
startIconIconComponent—Icon shown before the input.
statusInputStatus—Validation status displayed below the input.
stepnumber | null—Step increment for the number input.
styleCSSProperties—Inline styles applied to the field root, or to the input wrapper when the input is inside an InputGroup.
unitsstring | null—Unit label displayed after the input value.
value*number | null—Controlled numeric value.
isOptional*true—
isRequiredfalse—
hasClearfalse—Whether to show a clear button.
onChange*(value: number) => void—Called when the numeric value changes.

When isOptional: false, isRequired: true, hasClear: false

PropTypeDefaultDescription
autoCompletestring—HTML autocomplete attribute value.
classNamestring—Additional CSS class names applied to the field root, or to the input wrapper when the input is inside an InputGroup.
data-testidstring—Test ID applied to the input element.
descriptionReactNode—Supporting text displayed below the label.
endContentReactNode—Content rendered after the input, before the status icon.
hasAutoFocusbooleanfalseWhether to focus the input on mount.
htmlNamestring—HTML name attribute.
isDisabledbooleanfalseWhether the input is disabled.
isReadOnlybooleanfalseWhether the value is displayed without allowing focus or interaction.
isIntegerOnlybooleanfalseWhether to restrict input to integer values only.
isWheelEnabledbooleanfalseWhether scrolling the mouse wheel over the focused input changes its value.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
label*string—Field label.
labelEndReactNode—Content shown at the end of the label row, such as a link. It renders outside the label, so it does not focus the control or change its accessible name. It stays visible when isLabelHidden is true.
labelIconIconComponent—Icon rendered beside the label.
labelTooltipReactNode—Tooltip content shown next to the label.
maxnumber | null—Maximum allowed value.
minnumber | null—Minimum allowed value.
onBlur(event: FocusEvent<HTMLInputElement>) => void—Called when the input loses focus.
onEnter() => void—Called when Enter is pressed.
onFocus(event: FocusEvent<HTMLInputElement>) => void—Called when the input receives focus.
onKeyDown(event: KeyboardEvent<HTMLInputElement>) => void—Keyboard event handler for the input.
placeholderstring—Placeholder text.
refRef<HTMLInputElement>—Ref forwarded to the input element.
size"sm" | "md" | "lg"'md'Visual size.
startIconIconComponent—Icon shown before the input.
statusInputStatus—Validation status displayed below the input.
stepnumber | null—Step increment for the number input.
styleCSSProperties—Inline styles applied to the field root, or to the input wrapper when the input is inside an InputGroup.
unitsstring | null—Unit label displayed after the input value.
value*number | null—Controlled numeric value.
isOptionalfalse—
isRequired*true—
hasClearfalse—Whether to show a clear button.
onChange*(value: number) => void—Called when the numeric value changes.