open-index/open-npm huggingface dataset:
npm package: @hariria/react-text-mask
Description: React input component that accepts mask pattern
Author: M.K. Safi
Latest version: 5.4.5

# React Input Mask

## Getting started

First, install it.

```bash
npm i react-text-mask --save
```

Then, require it and use it.

```js
import React from 'react'
import MaskedInput from 'react-text-mask'

export default () => (
  <div>
    <MaskedInput
      mask={['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]}
    />
  </div>
)
```

`<MaskedInput/>` is fully compatible with `<input/>` element. So, you can
pass it CSS classes, a placeholder attribute, or even an `onBlur` handler.

For example, the following works:

```js
<MaskedInput
  mask={['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]}
  className="form-control"
  placeholder="Enter a phone number"
  guide={false}
  id="my-input-id"
  onBlur={() => {}}
  onChange={() => {}}
/>
```

## Documentation

For more information about the `props` that you can pass to the component, see
the [documentation here](https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md#readme).

## Example

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

1. Clone the repo, `git clone git@github.com:text-mask/text-mask.git`
1. `cd text-mask`
1. `npm install`
1. `npm run react:dev`
1. Open [http://localhost:3000](http://localhost:3000)

The code of the example is in [`react/example`](https://github.com/text-mask/text-mask/tree/master/react/example).

## Customize Rendered `<input>` Component

For advanced uses, you can customize the rendering of the resultant `<input>` via a render prop.
This is entirely optional, if no `render` prop is passed, a normal `<input>` is rendered.

For example, to use with styled-components,
[which requires an innerRef](https://www.styled-components.com/docs/advanced#refs):

```js
<MaskedInput
  mask={['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]}
  placeholder="Enter a phone number"
  id="my-input-id"
  render={(ref, props) => (
    <MyStyledInput innerRef={ref} {...props} />
  )}
/>

const MyStyledInput = styled.input`
  background: papayawhip;
`;
```

## Contributing

We would love some contributions! Check out [this document](https://github.com/text-mask/text-mask/blob/master/howToContribute.md#readme) to get started.
npm package: @hariria/text-mask-all
Description: Conforms string to given mask or pattern, and can be hooked up to input element
Author: M.K. Safi
Latest version: 0.3.1

# [![Text Mask](assets/logo.png)](https://github.com/text-mask/text-mask/#readme)

⚠️ This library is not maintained. Pull-requests and issues are not monitored. Alternatives to `text-mask` include:

* https://github.com/uNmAnNeR/imaskjs
* https://github.com/JsDaddy/ngx-mask

If you know other alternatives that should be listed here, email me at msafi@msafi.com.

-----

<!-- [![Build Status](https://travis-ci.org/text-mask/text-mask.svg?branch=master)](https://travis-ci.org/text-mask/text-mask) -->

Text Mask is an input mask library. It can create input masks for phone, date, currency, zip code, percentage, email, 
and literally anything!

There are convenient wrappers for React.

## Live demo

See it in action, [check out the demo page](https://text-mask.github.io/text-mask/).

## Installation and usage

* [React](react#readme)
## Expected to work with...

IE9+, Android, Samsung Internet, Windows Phone, iOS, Opera, Firefox, Safari, and Chrome

## Flexible

Text Mask is very configurable and allows you to create any type of input mask with minimal APIs.
[See the documentation for details](https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md#readme).

## Extendable

You can easily expand the base functionality of Text Mask with addons for more mask types. 
[Checkout existing addons](https://github.com/text-mask/text-mask/tree/master/addons/#readme).

## Robust

Text Mask supports pasting, browser auto-fill, and all operations that a user would expect while interacting with
an input field.

It works on mobile, has no 3rd party dependencies, and has a tiny footprint (less than 4KB gzipped).

## For any questions, suggestions, or feature requests

[Please file an issue](https://github.com/text-mask/text-mask/issues)!