ValyroUI Русская версия

Number Input

Numeric input. Free, MIT · Forms and input › Numbers, codes and masks

className and style go to the field wrapper; all other props go to the <input>.

Installation

npx valyro-cli@latest add number-input
npx shadcn@latest add https://valyro.xyz/r/number-input.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { NumberInput } from 'valyro-ui';

Props

PropTypeDefault
valuenumber | nullControlled value; use with onValueChange.
defaultValuenumber | nullnullInitial value when uncontrolled.
onValueChange(value: number | null) => voidCalled with the new value when it changes.
minnumberLower bound: typed and stepped values are clamped to it, and Home jumps to it.
maxnumberUpper bound: typed and stepped values are clamped to it, and End jumps to it.
stepnumber1Amount added by the stepper buttons and arrow keys; Shift and Page Up/Down step 10×.
precisionnumberDecimal places committed values are rounded to.
localestringBCP 47 locale for numbers and dates; defaults to the ThemeProvider's, then the browser's.
formatOptionsIntl.NumberFormatOptionsDisplay format, e.g. { style: 'currency', currency: 'USD' }. Percent values are fractions (0.5 = 50%).
allowWheelbooleanfalseStep with the mouse wheel while the input is focused. Off by default to avoid accidental changes.
size'sm' | 'md' | 'lg''md'Field height and text size.
invalidbooleanDanger border and aria-invalid on the input.
labelsPartial<NumberInputLabels>Accessible names of the stepper buttons.
namestringSubmits the plain number ("1250.5", empty when unset) with the form, not the formatted text.

Related components

Previous: Rating Input · Next: OTP Input · All Forms and input