Socket
Book a DemoInstallSign in
Socket

react-currency-input-mask

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-currency-input-mask

Input field preformated for displaying currencies, percents etc.

1.0.39
latest
Source
npmnpm
Version published
Weekly downloads
26
-49.02%
Maintainers
1
Weekly downloads
 
Created
Source

react-currency-input-mask

ReactJS simple currency input field

NPM JavaScript Style Guide

Install

npm i react-currency-input-mask --save

GitLab

https://gitlab.com/damjan89/react-money

Usage

React >= 16.9.0

import * as React from 'react'

import ReactMoneyComponent from 'react-currency-input-mask'
import 'react-currency-input-mask/src/assets/style.css'
class IndexComponent extends React.Component {
   constructor(props:any) {
       super(props);
       this.state = {
         price: 2.2,
         config:  {
           prefix: '$',
           suffix: '%',
           precision: 2,
           className: 'yourClassName',
           decimalSeparator: ',',
         }
       }
     }
/*
  * Name: changePrice
  * Description: This function is called when user change input value
  * Parameters: price(changed Price)
  * author: Nick Dam
  * */
  changePrice(price:number){
      this.setState({price: price})
  }
  render () {
    return (
        <div>
          <p>{this.state.price}</p>
          <ReactMoneyComponent 
              value={this.state.price} 
              config={this.state.config} 
              onChange={(e:any) => this.changePrice(e)}><
          /ReactMoneyComponent>
        </div>
    )
  }
}

Styling Component

In this.state.config add your class name!

To style input field:
.yourClassName .reactMoneyInput {
    //yourStyle
}

To style prefix:
.yourClassName .reactMoneyInputGroupPrepend {
    //yourStyle
}

To style suffix:
.yourClassName .reactMoneyInputGroupAppend {
    //yourStyle
}

License

MIT © Nick Dam

Keywords

React

FAQs

Package last updated on 24 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.