← All components
forms / stable

NumberField

Localized number input for money and quantities: Intl formatting, locale parsing, clamping, optional − / + buttons.

LIVE PREVIEW
Loading preview…

When to use

  • Money (`formatOptions={{ style: "currency", currency: "EUR" }}`), hours, quantities, percentages.
  • ERP rates, capacity, estimates, billing and time entry.

Consider an alternative

  • IDs, phone numbers, postcodes — use a text input.
  • Rough values — use Slider.

Import

import { NumberField } from '@revido-llc/kit';

Keyboard interaction

  • ↑ / ↓ — step
  • Page Up / Page Down — big step
  • Home / End — min / max

Props

Props documented by the Kit. Refer to the TypeScript types for the complete interface, including inherited props.

align"start" | "end""start"Right-align the number (amount columns).
classNamestring—Classes for the root (label + control + help).
controlClassNamestring—Classes for the bordered control.
descriptionReactNode—One short sentence of help under the control.
errorMessagestring | ((validation: ValidationResult) => string)—Error text shown while the field is invalid (or a function of the validation result).
inputMode"none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search"—Software keyboard on touch devices. Default: `decimal` when the format allows fractions, else `numeric` — chosen from the format, never the device, so the server and the browser render the same attribute (React Aria's device-based choice breaks hydration on phones and then sticks).
labelReactNode—Visible label. Omit only when an `aria-label` names the field.
placeholderstring—Placeholder shown while empty.
showStepperbooleanfalseShow − / + buttons. Off by default; arrow keys and the wheel still step.
sizeFieldSize"md"`md` 32px (default) or `compact` 28px for tables and toolbars.
autoFocusboolean—Whether the element should receive focus on render.
decrementAriaLabelstring—A custom aria-label for the decrement button. If not provided, the localized string "Decrement" is used.
defaultValuenumber—The default value (uncontrolled).
formstring—The `<form>` element to associate the input with. The value of this attribute must be the id of a `<form>` in the same document. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#form).
incrementAriaLabelstring—A custom aria-label for the increment button. If not provided, the localized string "Increment" is used.
isDisabledboolean—Whether the input is disabled.
isInvalidboolean—Whether the input value is invalid.
isReadOnlyboolean—Whether the input can be selected but not changed by the user.
isRequiredboolean—Whether user input is required on the input before form submission.
isWheelDisabledboolean—Enables or disables changing the value with scroll.
maxValuenumber—The largest value allowed for the input.
minValuenumber—The smallest value allowed for the input.
namestring—The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).
onChange((value: number) => void)—Handler that is called when the value changes.
renderDOMRenderFunction<"div", NumberFieldRenderProps>—Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
stepnumber—The amount that the input value changes with each increment or decrement "tick".
validate((value: number) => ValidationError | true)—A function that returns an error message if a given value is invalid. Validation errors are displayed to the user when the form is submitted if `validationBehavior="native"`. For realtime validation, use the `isInvalid` prop instead.
validationBehavior"native" | "aria"'native'Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.
valuenumber—The current value (controlled).

Examples

Currency (EUR, nl-NL)

Formats and parses in the user's locale; the value stays a plain number.

<NumberField label="Amount" value={amount} onChange={setAmount}
  formatOptions={{ style: "currency", currency: "EUR" }} />

Quantity with stepper

<NumberField label="Seats" showStepper minValue={1} maxValue={50} />

Percentage and validation

<NumberField label="Discount" formatOptions={{ style: "percent" }} />

Compact

<NumberField aria-label="Estimate" size="compact" />

Related components