Skip to content

numeric ​

Validates that a field contains a numeric value, with support for custom thousand and decimal separators.

Options ​

OptionTypeDefaultDescription
thousandsSeparatorstring""Character used as thousands separator (e.g. ",")
decimalSeparatorstring"."Character used as decimal separator
messagestringlocale defaultCustom error message

Playground ​

Valid values ​

ValueNotes
"1234.56"Standard decimal
"1,234.56"With thousands separator
"-42"Negative number

Invalid values ​

ValueReason
"abc"Not a number
"1.234,56"Separators swapped without reconfiguring

Notes ​

  • Empty string ("") always returns valid: true — validators only run on non-empty values. Combine with notEmpty to require a value.
  • For European format, use thousandsSeparator: "." and decimalSeparator: ",".

Released under the MIT License.