XGitHub

Leading Zeros

By default, Numora strips leading zeros from the integer part of a number. Set enableLeadingZeros to preserve them.

Removed (default)

Try typing "007" - it becomes "7"

<NumoraInput />

Preserved

Try typing "007" - it stays "007"

<NumoraInput enableLeadingZeros />

Rules

  • Only the integer part is affected - decimal zeros are never touched ("0.05" stays "0.05")
  • A bare "0" is always preserved
  • The sign is preserved for negative numbers ("-007""-7")

When to use each

  • Removed (default) - currency and general numeric inputs where leading zeros are meaningless
  • Preserved - product codes, IDs, or any format where zero-padding is significant

Auto-prepend leading zero

Set autoAddLeadingZero to automatically prepend 0 before a bare decimal separator. Useful when you want .5 stored as 0.5so the value is unambiguously parseable downstream.

Off (default)

Type ".5" - it stays ".5"

<NumoraInput />

On

Type ".5" - it becomes "0.5"

<NumoraInput autoAddLeadingZero />
  • Runs as the last sanitization step, after enableLeadingZeros trimming - safe to combine
  • Respects decimalSeparator (e.g. "," for European format)
  • Off by default