@penguin3007/currency-input

A simple currency input


Keywords
currency-input, currency, input
License
ISC
Install
npm install @penguin3007/currency-input@1.0.6

Documentation

Currency Input

Currency Input allows an easy input of currency formatted numbers based on the ECMAScript Internationalization API ( Intl.NumberFormat).

Built on Vue Currency Input and TypeScript

Guide

To use Currency Input just import component
import { Index } from '../dist/currencyInput.min.js';

Init class

const inputEl = document.getElementById('currency-input')

const currencyInput = new Index(inputEl, {
    options: {
      locale: 'de-DE', //BCP 47 language tag
      currency: 'EUR' //ISO 4217 currency code
    }
  });

Functions

getValue()

To get value from Currency Input use method
currencyInput.getValue() it returns Object

{
    "number": 300,
    "formatted": "300 €"
}

setValue(value)
To set value use method
currencyInput.setValue(value)

Options

List of options you can find here Options