Skip to content

Mortaro/nullstack-currency-input

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Currency Input for Nullstack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published