# use-input-text-mask

> ## Installation

Latest version **0.0.9** (published 2022-11-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-input-text-mask
pnpm add use-input-text-mask
yarn add use-input-text-mask
bun add use-input-text-mask
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2022-11-17 |
| First published | 2022-11-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 16.4 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alexsandr Serduck |
| Maintainers | awen2841 |
| Keywords | text mask, input mask, string mask, input formatting, text formatting, string formatting |

## Links

- npm: https://www.npmjs.com/package/use-input-text-mask
- Repository: https://github.com/awen2841/use-input-text-mask
- Homepage: https://6372c335d0a5ed54837bf503-gsngqmfplv.chromatic.com/
- Issues: https://github.com/awen2841/use-input-text-mask/issues
- npm.io page: https://npm.io/package/use-input-text-mask

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) 4.17.21

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.9 (latest) — 2022-11-17
- 0.0.8 — 2022-11-14
- 0.0.7 — 2022-11-14
- 0.0.6 — 2022-11-14
- 0.0.5 — 2022-11-14
- 0.0.4 — 2022-11-14
- 0.0.3 — 2022-11-14
- 0.0.2 — 2022-11-14
- 0.0.1 — 2022-11-14

## README

# useTextMask

## Installation

#### Yarn

```bash
yarn add use-input-text-mask
```

#### NPM

```bash
npm install use-input-text-mask
```

-----
[![npm](https://img.shields.io/npm/v/use-input-text-mask?style=flat)](https://www.npmjs.com/package/use-input-text-mask)
-----


Then, require it and use it.

```js
import React from 'react'
import { useInputTextMask } from 'use-input-text-mask';

export default () => {
  const mask = ['+', '1', ' ', '(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/];

  const { ref: inputRef, onChange } = useInputTextMask({ mask });
  
  return (
    <div>
      <input ref={inputRef} type="tel" 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-text-mask.git`
1. `cd use-input-text-mask/exemple`
1. `npm install`
1. `npm run storybook`
1. Open [http://localhost:6006](http://localhost:6006)

The code of the example is in [`exemple`](https://6372c335d0a5ed54837bf503-gsngqmfplv.chromatic.com/).

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