NumericInput
A specialized input component for numeric values with increment/decrement buttons and validation.
Basic Usage
Basic Numeric Input
import { NumericInput } from 'fluxo-ui';
function MyComponent() {
const [value, setValue] = useState(0);
return (
<NumericInput
label="Quantity"
value={value}
onChange={setValue}
/>
);
}Min/Max Range
With Range Constraints
<NumericInput
label="Score (0-100)"
value={value}
onChange={setValue}
min={0}
max={100}
placeholder="Enter score..."
/>Decimal Precision
With Decimal Places
<NumericInput
label="Price ($)"
value={value}
onChange={setValue}
maxDecimals={2}
min={0}
/>Stepper Buttons
Visible Stepper Buttons
Set showSteppers to render inline up/down buttons. The step prop controls the increment.
<NumericInput
label="Quantity"
value={value}
onChange={(e) => setValue(e.value ?? 0)}
showSteppers
step={1}
min={0}
max={10}
/>
<NumericInput
label="Price"
value={price}
onChange={(e) => setPrice(e.value ?? 0)}
showSteppers
step={0.5}
maxDecimals={2}
/>Keyboard Stepping
Keyboard Stepping (ArrowUp / ArrowDown)
Focus the input then press ArrowUp / ArrowDown to step by 1. Hold Shift for the larger step (10).
<NumericInput
label="Volume"
value={value}
onChange={(e) => setValue(e.value ?? 0)}
step={1}
largeStep={10}
min={0}
max={100}
/>Empty / Cleared
Empty / Cleared State
onChange now fires with value: undefined when the field is cleared, so controlled parents can react to an empty input.
const [value, setValue] = useState<number | undefined>(42);
<NumericInput
label="Optional age"
value={value}
onChange={(e) => setValue(e.value)}
placeholder="Leave empty if unknown"
/>
// e.value is number when filled, undefined when clearedStates
Input States
Value must be positive
<NumericInput label="Normal" value={42} onChange={setValue} />
<NumericInput label="Disabled" value={42} onChange={setValue} disabled />
<NumericInput label="Read Only" value={42} readonly />
<NumericInput label="With Error" error="Value must be positive" value={value} onChange={setValue} />Import
import { NumericInput } from 'fluxo-ui';Props
valuenumberCurrent numeric value (controlled)
valuenumberCurrent numeric value (controlled)
minnumberMinimum allowed value
minnumberMinimum allowed value
maxnumberMaximum allowed value
maxnumberMaximum allowed value
maxDecimalsnumber2Maximum number of decimal places
maxDecimalsnumber2Maximum number of decimal places
stepnumber1Increment used by ArrowUp/ArrowDown and stepper buttons
stepnumber1Increment used by ArrowUp/ArrowDown and stepper buttons
largeStepnumberIncrement used when Shift+ArrowUp/ArrowDown is pressed; falls back to step when not provided
largeStepnumberIncrement used when Shift+ArrowUp/ArrowDown is pressed; falls back to step when not provided
showSteppersbooleanfalseShow inline up/down stepper buttons inside the input
showSteppersbooleanfalseShow inline up/down stepper buttons inside the input
placeholderstringPlaceholder text
placeholderstringPlaceholder text
labelstringLabel text
labelstringLabel text
errorstring | booleanError message string (also marks invalid). Pass `true` to mark invalid without a message
errorstring | booleanError message string (also marks invalid). Pass `true` to mark invalid without a message
invalidbooleanForce the field into an invalid state without an error message
invalidbooleanForce the field into an invalid state without an error message
helperTextReactNodeHelper text rendered under the input and linked via aria-describedby
helperTextReactNodeHelper text rendered under the input and linked via aria-describedby
disabledbooleanfalseDisable the input
disabledbooleanfalseDisable the input
readonlybooleanfalseMake the input read-only
readonlybooleanfalseMake the input read-only
requiredbooleanfalseMark the input as required
requiredbooleanfalseMark the input as required
autoFocusbooleanfalseAuto focus the input on mount
autoFocusbooleanfalseAuto focus the input on mount
idstringUnique identifier for the input
idstringUnique identifier for the input
namestringName attribute for the input
namestringName attribute for the input
onChangefunctionChange event handler with numeric value
onChangefunctionChange event handler with numeric value
classNamestringAdditional CSS classes
classNamestringAdditional CSS classes
Features
Min / Max Constraints
Clamps the entered value within the configured min and max bounds
Decimal Precision
Restrict the number of decimal places with the maxDecimals prop
Validation States
Supports error messages, required marking, disabled and readonly modes
Keyboard Input
Accepts only numeric characters; blocks letters and special chars at the input level
Accessibility
Proper label association, aria-required, aria-invalid, and numeric role attributes
Theming
Full dark/light + 5 brand themes via CSS variables — zero extra config