vue-num-locale-input
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

vue-num-locale-input

npm version Monthly Downloads MIT License

Vue 3 form input field component edited as numeric input field, displayed as language sensitive text field.

  • For language-sensitive representation of numbers see Number.prototype.toLocaleString()
  • Locale formatted number is displayed only if the field does not have focus. Otherwise it looks and behaves as normal numeric input field.
  • Especially useful for creating clear and easy to read tables containing numbers.
  • Also useful for displaying numbers in exponential notation.

Samples

Bootstrap table, Czech locale, first field edited

Table, first item is edited

Bootstrap table, English locale, first field edited

Table, first item is edited

Installation

npm install vue-num-locale-input

Usage

<script>
import VueNumLocaleInput from "vue-num-locale-input";
</script>

<template>
  <VueNumLocaleInput
    v-model="yourNumericVariable"
    class="some-class"
    min="-10"
    max="10"
    step="2"
    :options="{minimumFractionDigits: 1, maximumFractionDigits: 1}"
  />
</template>

Important notes

  • Default locales is used (= browser settings). This version of the component does not allow to set it manually by props.
  • Property options is the same as documented in Intl.NumberFormat. Likely the most useful options are minimumFractionDigits and maximumFractionDigits, especially for tables, and notation: "scientific" for displaying numbers in exponential notation.
  • You must not use html attribute type (e.g. type="number") on the component. It breaks its functionality.

Package Sidebar

Install

npm i vue-num-locale-input

Weekly Downloads

3

Version

1.1.1

License

MIT

Unpacked Size

11.1 kB

Total Files

9

Last publish

Collaborators

  • radouch