XGitHub

Decimals

Control decimal precision, separators, and locale-aware formatting.

Precision limits

typescript
import { NumoraInput } from 'numora'

// Cap at 2 decimal places - extra digits are truncated on input
const input = new NumoraInput(container, {
  decimalMaxLength: 2,
})

// Pad to at least 2 decimal places - applied on blur
const input = new NumoraInput(container, {
  decimalMinLength: 2,
  decimalMaxLength: 18,
  // "1" on blur → "1.00"
})

Separators

typescript
import { NumoraInput } from 'numora'

// European format
const input = new NumoraInput(container, {
  decimalSeparator: ',',
  thousandSeparator: '.',
  // "1234.56" → "1.234,56"
})

For locale-aware separator detection, see Locale.

Automatic behaviors

  • Comma/dot conversion - when no thousand separator is set, both , and . keystrokes map to the configured decimal separator
  • Duplicate prevention - typing a second decimal separator is blocked
  • Paste cleanup - if multiple separators appear (e.g. "12.34.56"), all but the first are removed ("12.3456")