# react-easy-mask

> A simple masked input to React

Latest version **1.0.9** (published 2021-06-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-easy-mask
pnpm add react-easy-mask
yarn add react-easy-mask
bun add react-easy-mask
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2021-06-15 |
| First published | 2021-03-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 46.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Aldriê Mizobuti |
| Maintainers | aldrie_ |

## Links

- npm: https://www.npmjs.com/package/react-easy-mask
- npm.io page: https://npm.io/package/react-easy-mask

## Recent versions

- 1.0.9 (latest) — 2021-06-15
- 1.0.8 — 2021-06-15
- 1.0.7 — 2021-05-19
- 1.0.6 — 2021-05-18
- 1.0.5 — 2021-05-17
- 1.0.4 — 2021-05-10
- 1.0.3 — 2021-03-16
- 1.0.2 — 2021-03-15
- 1.0.1 — 2021-03-09
- 1.0.0 — 2021-03-03

## README

# react-easy-mask

> A simple masked input to React

[![NPM](https://img.shields.io/npm/v/react-easy-mask.svg)](https://www.npmjs.com/package/react-easy-mask)

## Install

```bash
npm install --save react-easy-mask
or
yarn add react-easy-mask
```

## Usage

```tsx
import React from 'react';
import { MaskedNumber } from 'react-easy-mask'

const App = () => {
  return (
    <MaskedNumber mask="###.##.#" onChangeValue={console.log} />
  );
};

export default App;
```

## Components
### MaskedNumber
* Props
  | Name           |      Type      |   Description  | Example | Return          |
  |:---------------|:---------------|:--------------:|--------:| ---------------:|
  | mask           |string          | a mask pattern | ###.##.#|    -            |
  | onChangeValue  |function        | change event   |         |unmasked value   |
  | ref            |IMaskedNumberRef| input ref      |         |    -            |
* Ref
  | Name           |      Type       |   Description            | Return  |
  |:---------------|:----------------|:-------------------------| -------:|
  | getValue       |function         | gets input value         |string   |
  | setValue       |function         | sets input value         |   -     |
  | focus          |function         |sets focus on the input   |   -     |
  | blur           |function         |removes focus on the input|   -     |

### MaskedCurrency
* Props

  | Name           |      Type        |   Description  | Example | Return          |
  |:---------------|:-----------------|:--------------:|--------:| ---------------:|
  | locale         |string            |  BCP 47 tag    | pt-BR   |    -            |
  | currency       |string            |  SO 4217 code  | BRL     |    -            |
  | onChangeValue  |function          | change event   |         | number          |
  | max            |number            | max value      |         |    -            |
  | ref            |IMaskedCurrencyRef| input ref      |         |    -            |
* Ref
  | Name           |      Type       |   Description            | Return  |
  |:---------------|:----------------|:-------------------------| -------:|
  | getValue       |function         | gets input value         |number   |
  | setValue       |function         | sets input value         |   -     |
  | focus          |function         |sets focus on the input   |   -     |
  | blur           |function         |removes focus on the input|   -     |
## License

MIT © [Aldriê Mizobuti](https://github.com/Aldrie)

---
_Source: https://npm.io/package/react-easy-mask · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
