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 numoraBasic 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, orWanformatOn- when separators are applied:FormatOn.Blur(default) orFormatOn.ChangedecimalMinLength- pad decimals to a minimum number of digits on blurenableNegative- allow negative values (defaultfalse)enableCompactNotation- expand1k → 1000on inputrawValueMode- emit raw values without separators inonChange
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.