XGitHub

Leading Zeros

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

typescript
import { NumoraInput } from 'numora'

// Default - leading zeros removed
// "007" → "7", "0001" → "1"
const input = new NumoraInput(container, {
  enableLeadingZeros: false,
})

// Leading zeros preserved
// "007" → "007", "0001" → "0001"
const input = new NumoraInput(container, {
  enableLeadingZeros: true,
})

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