UNPKG

vue-currency-input

Version:

Easy input of currency formatted numbers for Vue.js.

32 lines (20 loc) 2.25 kB
[![codecov](https://codecov.io/gh/dm4t2/vue-currency-input/graph/badge.svg?token=CAgHbikCov)](https://codecov.io/gh/dm4t2/vue-currency-input) [![npm Version](https://badgen.net/npm/v/vue-currency-input?color=green)](https://www.npmjs.com/package/vue-currency-input) [![npm Downloads](https://badgen.net/npm/dw/vue-currency-input?color=green)](https://www.npmjs.com/package/vue-currency-input) [![Bundlephobia](https://badgen.net/bundlephobia/minzip/vue-currency-input?color=green)](https://bundlephobia.com/result?p=vue-currency-input) [![License](https://badgen.net/github/license/dm4t2/vue-currency-input?color=green)](https://github.com/dm4t2/vue-currency-input/blob/main/LICENSE) # Vue Currency Input [![](docs/vue-currency-input.gif)](https://dm4t2.github.io/vue-currency-input) Vue Currency Input allows an easy input of currency formatted numbers based on the [ECMAScript Internationalization API (Intl.NumberFormat)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat). Built on top of the [Vue Composition API](https://v3.vuejs.org/guide/composition-api-introduction.html), it enables you to decorate _any_ input component with currency format capabilities. ## Features - Turns the input component of your favorite framework (for example [Vuetify](https://vuetifyjs.com/en/components/text-fields/), [Quasar](https://quasar.dev/vue-components/input) or [Element Plus](https://element-plus.org/en-US/component/input.html)) into a currency input field - Supports both Vue 2 _and_ Vue 3 - Built on standards: Ensures the right locale dependent formatting by using [Intl.NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) - Unobtrusive input by hiding the formatting on focus - Built-in value range validation ## Getting started Please read the [guide](https://dm4t2.github.io/vue-currency-input/guide) to get started or check out the [playground](https://dm4t2.github.io/vue-currency-input/playground) to see it in action. ## Support me If you find my work helpful, or you want to support the development, star the repo or buy me a coffee: [![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/D1D6SXEA)