nullstack-currency-input

1.0.2 • Public • Published

Nullstack Currency Input

Simple input that converts user formatted input into a number and the other way around.

Install

npm install --save nullstack-currency-input

Usage with one way binding

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;

Usage with two way binding

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;

Changing the separator

The default separator is a "."

You can override it by passing a separator attribute to the input

<CurrencyInput bind={this.price} separator="," />

Customization

You can customize the following attributes:

  • id
  • class
  • placeholder
  • disabled
  • data-*

License

Nullstack Currency Input is released under the MIT License.

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i nullstack-currency-input

    Weekly Downloads

    0

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    2.96 kB

    Total Files

    3

    Last publish

    Collaborators

    • mortaro