1.0.2 • Published 3 years ago

nullstack-phone-input v1.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
3 years ago

Nullstack Phone Input

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

Install

npm install --save nullstack-phone-input

Usage with one way binding

import Nullstack from 'nullstack';
import PhoneInput from 'nullstack-phone-input';

class Application extends Nullstack {

  phone = '51999999999';

  updatePhone({value}) {
    this.phone = value;
  }

  render() {
    return (
      <PhoneInput name="phone" value={this.phone} onchange={this.updatePhone} />
    )
  }

}

export default Application;

Usage with two way binding

import Nullstack from 'nullstack';
import PhoneInput from 'nullstack-phone-input';

class Application extends Nullstack {

  phone = '51999999999';

  render() {
    return (
      <PhoneInput bind={this.phone} />
    )
  }

}

export default Application;

Customization

You can customize the following attributes:

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

Caveats

Currently this component only works with the XX 99999.9999 format

License

Nullstack Phone Input is released under the MIT License.