Simple input that converts user formatted input into a number and the other way around.
npm install --save nullstack-currency-input
import Nullstack from 'nullstack';
import CurrencyInput from 'nullstack-currency-input';
class Application extends Nullstack {
price = 10;
updatePrice({value}) {
this.price = value;
}
render() {
return (
<CurrencyInput name="price" value={this.price} onchange={this.updatePrice} />
)
}
}
export default Application;
import Nullstack from 'nullstack';
import CurrencyInput from 'nullstack-currency-input';
class Application extends Nullstack {
price = 10;
render() {
return (
<CurrencyInput bind={this.price} />
)
}
}
export default Application;
The default separator is a "."
You can override it by passing a separator attribute to the input
<CurrencyInput bind={this.price} separator="," />
You can customize the following attributes:
- id
- class
- placeholder
- disabled
- data-*
Nullstack Currency Input is released under the MIT License.