Prodular UI

Number input

A numeric field with steppers, units, precision and locale formatting, that steps with the arrow keys and can be scrubbed by dragging its label.

npx prodular-ui add number-input

Quantity

Split steppers for small counts. Shift with an arrow key steps by largeStep.

$24 per seat, $288 a month. Shift and an arrow key steps by 10.

Units, precision and locale

A unit sits outside the value. format sets precision, locale sets grouping and decimal marks, scrubLabel lets people drag to adjust.

%
Request timeout
ms
EUR

Formatted for the German locale. Drag the Request timeout label to scrub its value.

Sizes

Matches Input heights, plus the disabled state.

Anatomy

<Field>  <FieldLabel>Seats</FieldLabel>  <NumberInput value={seats} onValueChange={setSeats} min={1} max={500} /></Field>

Guidance

Use it when

  • Quantities, limits, percentages and durations: anything people type as a number and sometimes nudge up or down.
  • steppers split for small counts people adjust by one, end for compact forms, none when values are usually typed.
  • unit for what the number means (%, ms, seats). It is never part of the value.

Avoid

  • Money. Use Amount input, which takes decimals and the symbol from the currency.
  • Identifiers that only look numeric, like phone numbers, postcodes or card numbers. Use Input.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Always give the field a name people can read: wrap it in Field with FieldLabel, or pass aria-label.
  • Set min and max whenever the backend has limits, and step to the real increment. Do not validate ranges yourself after the fact.
  • Set precision with format (maximumFractionDigits), not by rounding in onValueChange.
  • Use onValueChange for live updates and onValueCommitted to save, so a request is not sent on every keystroke.
  • The value can be null when the field is empty. Handle it.

API

NumberInput

PropTypeDefaultDescription
value / defaultValue / onValueChangenumber | nullControlled or uncontrolled value. Null when empty.
min / maxnumberClamp the value and disable the steppers at the limits.
step / smallStep / largeStepnumber1 / 0.1 / 10Arrow keys step by step, with Alt by smallStep and with Shift by largeStep.
formatIntl.NumberFormatOptionsPrecision and style, for example { maximumFractionDigits: 1 }.
localestringGrouping and decimal marks, for example de-DE.
steppers"split" | "end" | "none""split"Where the minus and plus controls sit.
unit / prefixReactNodeShown after or before the number, outside the value.
scrubLabelReactNodeA label that changes the value when dragged horizontally.
onValueCommitted(value) => voidFires on blur, Enter or a finished stepper press. Save here.
size"sm" | "default" | "lg""default"Height. Matches Input and Button sizes.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add number-input# or, with the registry in components.jsonnpx shadcn@latest add @prodular/number-input