Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
react-intl-number-input
Advanced tools
Readme
A React component for masked and formatted number input.
npm install react-intl-number-input
import React from 'react'
import { render } from 'react-dom';
import IntlNumberInput from 'react-intl-number-input';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
value: 0,
maskedValue: 0,
}
this.handleChange = this.handleChange.bind(this);
}
handleChange(event, value, maskedValue) {
event.preventDefault();
this.setState({ value, maskedValue });
}
render() {
return (
<div>
<p>
<IntlNumberInput onChange={this.handleChange} />
</p>
<p>
value: {this.state.value}
</p>
<p>
maskedValue: {this.state.maskedValue}
</p>
</div>
);
}
}
render(<App />, document.getElementById("root"));
Name | Type | Default Value | Description |
---|---|---|---|
value | number or string | 0 | Initial numeric value |
locale | string | 'en-US' | BCP 47 language tag. Defines a language code and a country or region code. Intl Locale Identification e.g. 'de-DE', 'pt-BR' and 'ja-JP' |
prefix | string | '' | String used as prefix for the masked value |
suffix | string | '' | String used as suffix for the masked value |
precision | number | 2 | Number of fraction digits to use |
onChange | function | n/a | (event, value, maskedValue) => {} Callback function to handle value changes |
// maskedValue: 1,234,567.89
<IntlNumberInput />
// maskedValue: 12,345.6789
<IntlNumberInput precision={4} />
// maskedValue: $1,234,567.89
<IntlNumberInput prefix="$" />
// maskedValue: 1,234%
<IntlNumberInput suffix="%" precision={0} />
// maskedValue: R$ 1.234.567,89
<IntlNumberInput
locale="pt-BR"
prefix="R$ "
precision={2}
/>
FAQs
A React component for masked and formatted number input.
The npm package react-intl-number-input receives a total of 94 weekly downloads. As such, react-intl-number-input popularity was classified as not popular.
We found that react-intl-number-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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.