Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-currency-input-field

Package Overview
Dependencies
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-currency-input-field

React component for formatting currency and numbers.

  • 3.6.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
212K
decreased by-2.54%
Maintainers
1
Weekly downloads
 
Created

What is react-currency-input-field?

The react-currency-input-field package is a React component that provides an input field for currency values. It allows for easy formatting, parsing, and validation of currency inputs, making it ideal for financial applications.

What are react-currency-input-field's main functionalities?

Basic Currency Input

This feature allows you to create a basic currency input field with default value and decimal limit. The onValueChange callback provides the current value and name of the input field.

import CurrencyInput from 'react-currency-input-field';

function App() {
  return (
    <CurrencyInput
      id="input-example"
      name="input-name"
      placeholder="Please enter a number"
      defaultValue={1000}
      decimalsLimit={2}
      onValueChange={(value, name) => console.log(value, name)}
    />
  );
}

Custom Currency Symbol

This feature allows you to add a custom currency symbol (e.g., $) to the input field. The prefix prop is used to specify the currency symbol.

import CurrencyInput from 'react-currency-input-field';

function App() {
  return (
    <CurrencyInput
      id="input-example"
      name="input-name"
      placeholder="Please enter a number"
      defaultValue={1000}
      decimalsLimit={2}
      prefix="$"
      onValueChange={(value, name) => console.log(value, name)}
    />
  );
}

International Currency Formatting

This feature allows you to format the currency input according to international standards. The intlConfig prop is used to specify the locale and currency type.

import CurrencyInput from 'react-currency-input-field';

function App() {
  return (
    <CurrencyInput
      id="input-example"
      name="input-name"
      placeholder="Please enter a number"
      defaultValue={1000}
      decimalsLimit={2}
      intlConfig={{ locale: 'en-US', currency: 'USD' }}
      onValueChange={(value, name) => console.log(value, name)}
    />
  );
}

Other packages similar to react-currency-input-field

Keywords

FAQs

Package last updated on 20 Oct 2022

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc