0.0.6 • Published 1 year ago

use-input-phone-mask v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

useInputPhoneMask

Installation

Yarn

yarn add use-input-phone-mask

NPM

npm install use-input-phone-mask

npm

Then, require it and use it.

import React from 'react'
import { useInputPhoneMask } from 'use-input-phone-mask';

export default () => {
  const { ref: inputRef, onChange } = useInputPhoneMask({ mask: '+# (###)###-####' });
  
  return (
    <div>
      <input ref={inputRef} onChange={onChange} />
    </div>
  )
}

Example

To see an example of the code running, follow these steps:

  1. Clone the repo, git clone https://github.com/awen2841/use-input-phone-mask.git
  2. cd use-input-phone-mask/exemple
  3. npm install
  4. npm run storybook
  5. Open http://localhost:6001

The code of the example is in exemple.