Components · Form & Input
Number Input
A numeric input with optional steppers. Limits apply when the field loses focus; `nullable` lets it be empty.
import { NumberInput } from '@nexub/react';Usage
A quantity people type or step: seats, limits, percentages.
A value that may be empty (`nullable`) and must stay inside `min` and `max`.
On a page without React (server-rendered HTML, a plain `<form>`): use `<nx-number-input>` from `@nexub/elements`, the same rules as a web component.
Money: use MoneyInput. Phone numbers and codes: use a text input.
Playground
Props
<NumberInput defaultValue={0} />Examples
Default
With range
Can be empty
`nullable`: cleared means null. The limits apply on blur.
States
defaultdisabledinvalidsize="sm"size="md"size="lg"
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | number | — | Controlled value. null (with nullable) shows an empty field. |
| nullable | false | false | The field can be empty: clearing it reports null, not 0, and a half-typed 2. or - stays while focused. |
| onValueChange | ((value: number) => void) | — | Called while typing (not yet clamped) and with the clamped value on blur, steppers and arrow keys. With nullable, null when cleared. |
| min | number | — | Lowest value, applied on blur, steppers and arrow keys (never mid-typing, so 30 can be typed with a minimum of 15). |
| max | number | — | Highest value, applied the same way. |
| step | number | 'any' | 1 | Increment for steppers and arrow keys. 'any' allows any decimal (steppers then move by 1). |
| disabled | boolean | — | Disables the input and its controls. |
| size | 'sm' | 'md' | 'lg' | 'md' | Controls font size and padding. |
| defaultValue | number | — | |
| invalid | boolean | — | |
| precision | number | — | |
| showSteppers | boolean | false |
On iOS & Android: Stepper
import { Stepper } from '@nexub/react-native';
<Stepper label="Guests" min={1} max={8} defaultValue={2} />Web vs mobile
Same tokens and prop names. Where the platforms differ:
| Web | iOS & Android | |
|---|---|---|
| Control | A field with steppers; type a number. | Stepper: − / + buttons with the value between; no keyboard. |
Interactive preview of @nexub/react-native rendered for the web. Native chrome (switches, pickers, Liquid Glass) looks like the platform on a device.
On device

iPhone (iOS simulator)

Pixel (Android emulator)
Screenshots from the latest CI run of the showcase app; the live frame renders the same code for the web.
Stepper props
| Prop | Type | Default | Description |
|---|---|---|---|
| nullable | false | false | Whether the value can be empty (null). |
| value | number | — | — |
| defaultValue | number | — | — |
| onValueChange | (value: number) => void | — | — |
| labelrequired | string | — | Accessible name of the value, e.g. "Guests". |
| min | number | 0 | Applied on a step and when typing ends (blur), never while typing. |
| max | number | 100 | Applied on a step and when typing ends (blur), never while typing. |
| step | number | 1 | — |
| disabled | boolean | — | — |
| invalid | boolean | — | Error colour on the value and announced as invalid. |
| size | Extract<ControlSize, 'sm' | 'md' | 'lg'> | 'md' | Size of the buttons and the value. |
| precision | number | — | Decimals shown and kept after a step, e.g. 2 shows 1.5 as "1.50". |
| showSteppers | boolean | true | Shows the − and + buttons. Without them the value is a number field typed on the keypad; screen readers can still swipe up and down to step it. |
| style | StyleProp<ViewStyle> | — | — |