Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
react-currency-masked-input
Advanced tools
<CurrencyInput />
Creates an input that gets masked as currency, in React.
Note: Dollar sign and styling not included
i.e.,
Entering a 1 shows: $0.01.
Entering 11 shows: $0.11.
Entering 110 shows: $1.10.
And so on.
Install via npm: npm install react-currency-masked-input
.
It accepts all properties you'd normally set on an input, so:
// your standard input
render() {
return <input name="myInput" placeholder="0" required />
}
Becomes a matter of simply replacing the tag to CurrencyInput
:
// with a currency mask
import CurrencyInput from 'react-currency-masked-input'
//...
render() {
return <CurrencyInput name="myInput" required />
}
Prop | Description | Values | Default |
---|---|---|---|
separator | The character use as a decimal point | . , , | . |
Usage notes:
type="number"
and pattern="\d*"
, but will override those props if you pass them in.defaultValue
prop passed in as an initial value, but will take over from there.props.value
is passed to it.onChange
prop after updating its internal value. First argument is the original event, the second is the masked value.myComponent.refs.input.value
, as you would with a normal ref.yarn
- install local dependencies
npm run bundle
- compiles source code to ./react-currency-masked-input.js
npm test
- Runs the unit tests in watch mode
npm run test:ci
- Runs the tests once; useful in CI.
FAQs
A currency input for React
We found that react-currency-masked-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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.