Skip to main content

Number Input

Formatted number input with controls and validation

Basic Usage

Current value: 42

Code

Without Controls

Value: undefined

Decimal Precision

Value: 5.50%

Formatted Display

Value: 1,234.56

Currency Input

Raw value: 99.99

Real-World Example

Product Order

Select quantity to calculate total

Unit Price:$29.99
Total:$29.99

Use Cases

💰Pricing Forms

🔢Quantity Calculators

⚙️Settings Controls

📊Financial Data Entry

API Reference

NameTypeDefaultDescription
value
numberControlled value
defaultValue
numberDefault uncontrolled value
onChange
(value: number | undefined) => voidCallback when value changes
onValueChange
(value: number | undefined) => voidAlternative callback for value changes
min
numberMinimum allowed value
max
numberMaximum allowed value
step
number1Increment/decrement step size
precision
number0Number of decimal places
showControls
booleantrueShow increment/decrement buttons
formatDisplay
(value: number) => stringCustom display formatter
parseValue
(value: string) => number | undefinedCustom value parser
allowNegative
booleantrueAllow negative values
allowDecimal
booleantrueAllow decimal values
thousandsSeparator
string | booleanfalseThousands separator character or enable default
decimalSeparator
string"."Decimal separator character
disabled
booleanfalseDisable the input

Features

  • Increment/decrement buttons
  • Keyboard support (arrow up/down)
  • Min/max validation
  • Decimal precision
  • Customizable thousands separators
  • Custom format and parse functions
  • Currency and percentage support
  • Controls-free mode
  • RTL/LTR support
  • Full accessibility