Numora React
Numora React is a replacement for <input> that handles numeric formatting, sanitization and cursor management in React. It is a forwardRef component that works controlled and uncontrolled and accepts standard HTML input attributes. It manages type and inputMode itself, and maxLength counts the raw value.
Why numora?
If you audit the codebases of the top 10 DeFi protocols - Uniswap, Aave, Curve, Balancer - you'll notice a pattern. For the most critical UI component in finance, the numeric input, every single one has built a custom implementation from scratch.
- Uniswap maintains ~200 lines of custom regex and locale logic.
- Aave wraps a formatting library with heavy custom validation.
- Curve relies on a complex chain of hooks to handle state.
There is no standard. Every team wastes days reinventing the wheel: comma/dot separator logic, parseFloat precision loss, mobile keyboard ghost characters.
numora is the new standard for numeric inputs - a precision-first library you drop in once, configure with options, and forget about.
See Installation for the component API and props.
Raw and formatted values
On every change, e.target.value is the raw numeric string, with no thousand separators or other formatting characters. Its decimal mark is always ., even with a custom decimalSeparator or a locale, so you can pass it directly to BigNumber, ethers.js, viem or any precision math library.
e.target.formattedValue is the display string, with thousand separators and decimal formatting, for showing to the user. onValueChange gives you both values in one call.
By default, grouping is 'thousand' with , as the separator, the same as the vanilla numora package. Pass groupingStyle="none" to turn grouping off.
Works with
- Controlled and uncontrolled use, with no special props
- React Hook Form, through
Controller - Formik, as a custom field component
forwardRef, which passes refs to the underlying input- TypeScript types for props, events and options
The component runs on the core numora engine, so both packages share the same formatting behavior.