Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@rschpdr/react-money-input
Advanced tools
A currency text input for React that Just Works™
currency.js
enforced numeric float valuesFormik
npm install --save @rschpdr/react-money-input currency.js
import React, { useState } from "react";
import MoneyInput from "react-money-input";
function Example(props) {
const [amount, setAmount] = useState(0);
function handleChange(e) {
setAmount(e.target.value);
}
return <MoneyInput onChange={handleChange} value={amount} />;
}
export default Example;
Props | Options | Default | Description |
---|---|---|---|
className | string | '' | Regular React classname |
style | Styles object | {} | Regular React styles object |
currencyConfig | Currency configuration object |
| Config options for Number.toLocaleString method. See more |
customInput | Component Reference | undefined | Support for custom inputs e.g. Material UI TextField |
name | string | undefined | Regular name HTML property |
id | string | undefined | Regular id HTML property |
max | number | Number.MAX_SAFE_INTEGER | Maximum allowed value |
onChange | (event) => any | undefined | onChange event handler. event is a fake Synthetic Event with only value , name and id properties defined inside target |
value | number | undefined | Input value |
Simply pass the custom input component as a prop. Pass the custom input props directly to MoneyInput
:
import React, { useState } from "react";
import { TextField } from "@material-ui/core";
import MoneyInput from "react-money-input";
function Example(props) {
const [amount, setAmount] = useState(0);
function handleChange(e) {
setAmount(e.target.value);
}
return (
<MoneyInput
customInput={TextField}
variant="outlined"
label="Custom Input!"
onChange={handleChange}
value={amount}
/>
);
}
export default Example;
All contributions welcome! Feel free to raise issues or submit a PR.
This project is licensed under the MIT License - see LICENSE.md for details.
Go give them stars!
FAQs
A currency text input for React that Just Works™
The npm package @rschpdr/react-money-input receives a total of 678 weekly downloads. As such, @rschpdr/react-money-input popularity was classified as not popular.
We found that @rschpdr/react-money-input demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.