Skip to content

Formatting

Numora React adds thousand separators as the user types by default, or only on blur with formatOn="blur". It keeps the cursor position in both modes.

By default, grouping is 'thousand' with , as the thousand separator, in both the React component and the vanilla numora package. Pass groupingStyle="none" to turn grouping off. 'thousand' (1,234,567) is the default, so the demos below show the other two styles.

Wan grouping: 1234,5678

Groups of 4 from the right.

Grouping style

Other grouping styles

Lakh (Indian, 12,34,567)

Type a large number to see Lakh grouping

import { NumoraInput } from 'numora-react'

<NumoraInput groupingStyle="lakh" />

Wan (East Asian, 123,4567)

Type a large number to see Wan grouping

import { NumoraInput } from 'numora-react'

<NumoraInput groupingStyle="wan" />

When to format

The separators appear on every keystroke by default, or only on blur with formatOn="blur". See Change vs blur for both modes.

When the separators move, the caret stays between the same two digits:

Naive formatter

NumoraInput

The 9 lands at the end in naive. Numora puts it after the 8.

Separator skipping

  • Backspace and Delete jump over thousand separators, so you never delete one by hand.
  • This applies with formatOn="change", a thousand separator set and no text selected. In blur mode a focused field has no separators to skip.
  • Two handlers share the work. keydown moves the cursor over the separator, and beforeinput deletes the digit. Mobile keyboards that send no usable keydown still work, because beforeinput then deletes the digit past the separator itself.
Backspace after a comma
With Numora

beforeinput then deletes the 1.