react-currency-field

1.2.0 • Public • Published

React Currency Field

A simple and small component to handle currency in react.

How to install

yarn add react-currency-field

How to use

  import ReactCurrencyInput from 'react-currency-field';

  <ReactCurrencyInput
    locale="en-US"
    value={this.state.value}
    onChange={(event, values) => {
      this.setState({
        value: values.floatValue
      });
    }}
  />

Props

Prop Type Default Description
value number 0.0 -
onChange function(event, value: { formatedValue, floatValue }) -
locale string or object en-US a string (pt-BR or en-US) or a config object

Locale Config

  {
    charThousands: ',',
    charDecimal: '.',
    symbol: '$',
    decimalScale: 2,
  }

Contributions are welcome!

Readme

Keywords

none

Package Sidebar

Install

npm i react-currency-field

Weekly Downloads

2

Version

1.2.0

License

none

Unpacked Size

308 kB

Total Files

30

Last publish

Collaborators

  • hermes_netto