Officina UI
Components

NumberInput

Numeric field with stepper buttons, min/max clamping, precision, and keyboard increments.

NumberInput is a controlled numeric field whose value is a number or null when empty. It clamps to min/max, rounds to precision decimals, and shows optional +/- stepper buttons. Arrow keys step by step, PageUp/PageDown step by ten, and Home/End jump to the bounds. Add a prefix or suffix to show a unit inside the field.

Example

Preview
%
import { NumberInput } from '@officina/ui';
import { useState } from 'react';

function Example() {
  const [value, setValue] = useState<number | null>(1);
  return <NumberInput value={value} onChange={setValue} min={0} max={10} step={1} suffix="qty" />;
}

API

PropTypeDefaultDescription
onChange*(value: number | null) => void—Called with the parsed value (null when cleared).
value*number | null—Current value, or null when empty.
ariaLabelstring—Accessible name when no visible label is present.
disabledboolean—
invalidboolean—Marks the field invalid for validation styling and `aria-invalid`.
maxnumber—Maximum allowed value.
minnumber—Minimum allowed value.
namestring—Form field name, for native form submission / form libraries.
placeholderstring—
precisionnumber—Number of decimal places to enforce.
requiredboolean—
showSteppersbooleantrueShow the stepper +/- buttons.
sizeenummdControl size.
stepnumber1Increment/decrement step. Defaults to 1.
suffixstring—Unit suffix shown inside the field (e.g. "%").

On this page