Vue numeric input
Numora is a Vue numeric input library. It handles thousand separators, decimal limits, paste sanitization, scientific-notation expansion and cursor preservation through a v-numora custom directive that mounts directly on an <input>. The vanilla package is framework-agnostic TypeScript, 8.3 kB gzipped, with zero runtime dependencies. The same engine works in Vue 3, Nuxt 3, VeeValidate, FormKit and Pinia, with no wrapper package.
Installation
Vue 3 directive
NumoraInput attaches directly to an existing <input> element. A custom directive is the usual Vue 3 adapter. Add this helper to your project once, and every <input v-numora="opts"> works.
src/directives/numora.ts:
Register globally in src/main.ts (or import and declare locally in any <script setup>):
Component <script setup lang="ts">:
Component <template>:
Numora adopts the <input> and sets the attributes it needs (type, inputmode, autocomplete and others). onValueChange receives { value, formattedValue }, where value is the raw string (see value types). By default, Numora formats on every keystroke (see formatting).
Read the value from onValueChange, not from v-model. The element's own value is the display string ("1,234.56"). onValueChange gives you the raw value ("1234.56").
Animated example: Numora + Torph in Vue 3
Stack a Torph TextMorph over a transparent-text NumoraInput. The Torph integration explains the overlay and has the shared CSS and install steps. Below is the Vue 3 lifecycle and the scoped-style note.
Script block (inside <script setup lang="ts">):
Template (inside <template>):
Use the overlay CSS from the Torph page in <style scoped>. Wrap the selectors that target the runtime-created <input> in :deep(), because scoped styles cannot reach it otherwise:
FAQ
What is the best Vue numeric input library?
Numora is framework-agnostic TypeScript, 8.3 kB gzipped, with no runtime dependencies. In Vue you register a v-numora directive once, then write <input v-numora="opts" /> anywhere.
Is there a numora-vue package?
No, and you do not need one. The v-numora directive is the entire Vue adapter.
Does Numora work with Nuxt 3 and SSR?
Yes. NumoraInput touches the DOM, so the v-numora directive only initializes in the mounted hook, which only runs in the browser. Nuxt renders the empty <input> on the server and Numora adopts it on hydration. Nuxt has no main.ts, so register the directive in a plugin with nuxtApp.vueApp.directive('numora', vNumora), or import vNumora in the component.
How do I add thousand separators to a Vue number input?
Nothing to configure. Grouping on every keystroke is the default. Numora formats as the user types and keeps the cursor between the same two digits when it inserts a comma. onValueChange receives { value, formattedValue }, where value is the raw value without separators, which you can store in a ref, Pinia, VeeValidate or FormKit.
Does it work with VeeValidate, FormKit or Pinia in Vue?
Yes. onValueChange receives { value, formattedValue }, and value is the raw string. Pass it to VeeValidate, FormKit, Pinia or any other state library as you would a v-model value.
Does it support i18n (decimal commas, locale grouping) in Vue?
Yes. Set decimalSeparator: ',' and thousandSeparator: '.' (or use the locale option) for European formats. The raw value is a plain dot-decimal string in every locale.
Why not v-model on a plain <input>?
A plain v-model has no thousand separators, decimal limits or paste sanitization, and you would have to write the cursor-positioning logic yourself. Numora handles all of it.
Can I animate digits in Vue?
Yes. The Torph + Numora overlay pattern is vanilla DOM, so it works inside any Vue component. Torph respects prefers-reduced-motion by default.