NumberInput
Components

NumberInput

Numeric field with stepper buttons. Steps, clamps, and accelerates with Shift.

Props

NumberInputProps props
PropTypeDefaultDescription
valuenumber | null—Controlled value.
defaultValuenumber | null—Initial uncontrolled value.
onChange(value: number | null) => void—Change handler.
minnumber—Minimum value, clamped on blur and enter.
maxnumber—Maximum value, clamped on blur and enter.
stepnumber1Amount to increment or decrement per click.
shiftStepnumber10Multiplier applied to step while Shift is held.
prefixReactNode—Static text inside the field, before the number (e.g. '$').
suffixReactNode—Static text inside the field, after the number (e.g. '%', 'ms').
hideStepperboolean—Hide the spinner buttons and keep only arrow-key/scroll stepping.
size"sm" | "md""md"Control height.
disabledboolean—Prevents interaction.
invalidboolean—Invalid styling. Defaults to the enclosing Field error state.
containerClassNamestring—Class applied to the Control wrapper. className applies to the input element.

Usage

NumberInput changes values through step buttons, arrow keys, and press-and-hold repeat. Shift multiplies the step by shiftStep. Values are clamped to min and max on blur or Enter. Draft text is not clamped on each keystroke.

Basic with min/max/step

NumberInput

With suffix

NumberInput with suffix

With prefix

NumberInput with prefix

Hide stepper

NumberInput hideStepper
ImportTSX
import { NumberInput } from "@solarius/onset";
import type { NumberInputProps } from "@solarius/onset";

<NumberInput min={0} max={100} step={5} />
<NumberInput suffix="%" defaultValue={42} />
<NumberInput prefix="$" defaultValue={29.99} step={0.01} />
<NumberInput hideStepper defaultValue={7} />