All Projects → thiagozanetti → react-intl-currency-input

thiagozanetti / react-intl-currency-input

Licence: MIT license
React component for i18n currency input using Intl API.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to react-intl-currency-input

v-intl
Add i18n to your awesome Vue 3 app 🔉
Stars: ✭ 13 (-91.77%)
Mutual labels:  intl, intl-api
sticky-react-table
A sticky positioned table built for React
Stars: ✭ 14 (-91.14%)
Mutual labels:  react16
Intl
A PHP replacement layer for the C intl extension that also provides access to the localization data of the ICU library.
Stars: ✭ 2,323 (+1370.25%)
Mutual labels:  intl
Helium.js
Automating Universal React Applications
Stars: ✭ 63 (-60.13%)
Mutual labels:  react16
arbify flutter
Flutter package providing Arbify support.
Stars: ✭ 18 (-88.61%)
Mutual labels:  intl
docker-php7
A docker image with php 7 and extensions (apc, apcu, intl, mcrypt,...)
Stars: ✭ 16 (-89.87%)
Mutual labels:  intl
Formatjs
The monorepo home to all of the FormatJS related libraries, most notably react-intl.
Stars: ✭ 12,869 (+8044.94%)
Mutual labels:  intl
svelte-intl
Internationalize your Svelte apps using format-message and Intl object
Stars: ✭ 48 (-69.62%)
Mutual labels:  intl
react-typescript
React16 + HMR + typescript + webpack + tslint + tests
Stars: ✭ 21 (-86.71%)
Mutual labels:  react16
detect-browser-language
Detect browser language
Stars: ✭ 35 (-77.85%)
Mutual labels:  intl
iXn
Control your localization of apps
Stars: ✭ 20 (-87.34%)
Mutual labels:  intl
next-intl
Library to integrate react-intl with Next.js.
Stars: ✭ 41 (-74.05%)
Mutual labels:  intl
react-mobx-antd-boilerplate
react16-router4--mobx-antd3--webpack4-boilerplate
Stars: ✭ 15 (-90.51%)
Mutual labels:  react16
Sonataintlbundle
Symfony SonataIntlBundle
Stars: ✭ 212 (+34.18%)
Mutual labels:  intl
rescript-intl
ReScript wrapper on top of JavaScript's Intl
Stars: ✭ 18 (-88.61%)
Mutual labels:  intl
Laravel Intl
🚫 [ABANDONED] Easy to use internationalization/localization functions for Laravel 5
Stars: ✭ 185 (+17.09%)
Mutual labels:  intl
mf-lite
🎉 优雅且实用的基于 webpack module federation 的微前端解决方案 / Elegant and practical micro front-end solution based on webpack module federation.
Stars: ✭ 126 (-20.25%)
Mutual labels:  intl
mobxSpa
企业级SPA项目,完整开发脚手架
Stars: ✭ 96 (-39.24%)
Mutual labels:  react16
symfony-intl-fix
Provides the symfony/intl fix for new php version in symfony 2.8
Stars: ✭ 20 (-87.34%)
Mutual labels:  intl
validarium
🛡Agnostic validation library for JavaScript applications.
Stars: ✭ 29 (-81.65%)
Mutual labels:  intl

react-intl-currency-input

A React component for i18n currency input using Intl API.

Installation

$ npm install react-intl-currency-input --save-dev

How to use

import React from "react"
import IntlCurrencyInput from "react-intl-currency-input"

const currencyConfig = {
  locale: "pt-BR",
  formats: {
    number: {
      BRL: {
        style: "currency",
        currency: "BRL",
        minimumFractionDigits: 2,
        maximumFractionDigits: 2,
      },
    },
  },
};

const BrlCurrencyComponent = () => {
  const handleChange = (event, value, maskedValue) => {
    event.preventDefault();

    console.log(value); // value without mask (ex: 1234.56)
    console.log(maskedValue); // masked value (ex: R$1234,56)
  };

  return(
    <IntlCurrencyInput currency="BRL" config={currencyConfig}
            onChange={handleChange} />
  );
}

export default BrlCurrencyComponent;

Example

example

To run the example:

$ npm run example:start

And a new browser window will open at http://localhost:3000

Properties

Name Type Default Description
defaultValue number 0 Sets the default / initial value to be used by the component on the first load
currency string USD Sets the currency code
config object USD related configuration Configuration object compliant with react-intl intlShape
autoFocus boolean false Enables auto-focus when the component gets displayed
autoSelect boolean false Enables auto-select when the component gets displayed
autoReset boolean false Resets component's internal state when loses focus
onChange function undefined (event, value, maskedValued) => {}

Exposes the Event itself, the value with no mask and maskedValue for displaying purposes
onFocus function undefined (event, value, maskedValued) => {

Called when the component gains focus
onBlur function undefined (event, value, maskedValued) => {

Called when the component loses focus
onKeyPress function undefined (event, key, keyCode) => {}

Called when a key is pressed
max number undefined Maximum value for the input. Input does not change if the value is greater than max

All the other undocumented properties available for any React Component should also be available.

TO-DO

  • Add unit tests
  • Add a Storybook for examples and UI tests
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].