XGitHub

Install Numora - JavaScript Numeric Input

Add the numora JavaScript numeric input library to any project - no framework required.

Install

numora has zero runtime dependencies. Pick your package manager:

bash
pnpm add numora

Basic Usage

Import the NumoraInput class and attach it to any container element:

typescript
import { NumoraInput } from 'numora'

const container = document.querySelector('#my-input-container')

const numoraInput = new NumoraInput(container, {
  maxDecimals: 2,
  thousandSeparator: ',',
  decimalSeparator: '.',
})

Options

numora accepts a FormattingOptions object as the second argument. Common options:

  • decimalSeparator - character separating integer from decimal part (default '.')
  • thousandSeparator - character inserted between digit groups (default ',')
  • thousandStyle - None, Thousand, Lakh, or Wan
  • formatOn - when separators are applied: FormatOn.Blur (default) or FormatOn.Change
  • decimalMinLength - pad decimals to a minimum number of digits on blur
  • enableNegative - allow negative values (default false)
  • enableCompactNotation - expand 1k → 1000 on input
  • rawValueMode - emit raw values without separators in onChange

See the Formatting and Sanitization docs for the full options reference.

TypeScript

numora ships with full TypeScript declarations - no @types package needed. Import types directly:

typescript
import { NumoraInput, FormatOn, ThousandStyle } from 'numora'
import type { FormattingOptions } from 'numora'

const options: FormattingOptions = {
  maxDecimals: 6,
  formatOn: FormatOn.Change,
  thousandStyle: ThousandStyle.Thousand,
  thousandSeparator: ',',
}

Next Steps

Learn how the beforeinput-based event architecture works in How It Works, or jump to the Formatting feature docs.