1.0.2 • Published 3 years ago

ac-react-currency-input v1.0.2

Weekly downloads
7
License
MIT
Repository
github
Last release
3 years ago

react-currency-input

React currency input This component handles currency format across browser locales and languages

NPM JavaScript Style Guide

Install

npm install --save ac-react-currency-input

Usage

import React, { Component } from 'react'

import ReactCurrencyInput from 'react-currency-input'
import 'react-currency-input/dist/index.css' // or use class react-currency-input for your own styles

class Example extends Component {
  render() {
    return <ReactCurrencyInput value={150} currency="EUR"  autoFocus={true} />
  }
}

Custom config

const config: ConfigInterface = {
  locale: 'de-De' // en || en-US || ....
  formats: {
    number: {
      EUR: {
        style: "currency"
        currency: 'EUR'
        minimumFractionDigits: 2
        maximumFractionDigits: 2
      }
    }
  }

  <ReactCurrencyInput value={150} currency="EUR"  autoFocus={true} config={config}/>

Custom styling

.react-currency-input {
  margin: 0 auto;
  align-items: center;
  align-self: center;
  text-align: center;
  ...
}

License

MIT © AhmedCommando