# @types/react-input-mask

> TypeScript definitions for react-input-mask

Latest version **3.0.6** (published 2024-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/react-input-mask
pnpm add @types/react-input-mask
yarn add @types/react-input-mask
bun add @types/react-input-mask
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.6 |
| Published | 2024-11-07 |
| First published | 2017-01-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51469 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/react-input-mask
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-input-mask
- npm.io page: https://npm.io/package/@types/react-input-mask

## Dependencies (1)

- [@types/react](https://npm.io/package/@types/react.md) *

## Recent versions

- 3.0.6 (latest) — 2024-11-07
- 3.0.5 (ts4.5) — 2023-11-07
- 3.0.2 (ts4.1) — 2022-11-04
- 3.0.1 (ts3.6) — 2021-07-07
- 3.0.0 (ts3.3) — 2020-11-23
- 2.0.5 (ts2.9) — 2019-12-10
- 1.2.2 (ts2.8) — 2018-08-04
- 1.2.1 (ts2.6) — 2018-05-15
- 0.7.7 (ts2.3) — 2017-07-11
- 0.7.5 (ts2.1) — 2017-06-20
- 0.7.0 (ts2.0) — 2017-01-17
- 1.2.6 — 2023-11-07
- 1.2.5 — 2023-10-18
- 3.0.4 — 2023-10-18
- 3.0.3 — 2023-09-27
- … 14 more at https://npm.io/package/@types/react-input-mask/versions

## README

# Installation
> `npm install --save @types/react-input-mask`

# Summary
This package contains type definitions for react-input-mask (https://github.com/sanniassin/react-input-mask).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-input-mask.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-input-mask/index.d.ts)
````ts
import * as React from "react";

export interface Selection {
    start: number;
    end: number;
}

export interface InputState {
    value: string;
    selection: Selection | null;
}

export interface BeforeMaskedStateChangeStates {
    previousState: InputState;
    currentState: InputState;
    nextState: InputState;
}

export type Props = Omit<React.InputHTMLAttributes<HTMLInputElement>, "children"> & {
    /**
     * Mask string. Format characters are:
     * * `9`: `0-9`
     * * `a`: `A-Z, a-z`
     * * `\*`: `A-Z, a-z, 0-9`
     *
     * Any character can be escaped with backslash, which usually will appear as double backslash in JS strings.
     * For example, German phone mask with unremoveable prefix +49 will look like `mask="+4\\9 99 999 99"` or `mask={"+4\\\\9 99 999 99"}`
     */
    mask: string | Array<(string | RegExp)>;
    /**
     * Character to cover unfilled editable parts of mask. Default character is "_". If set to null, unfilled parts will be empty, like in ordinary input.
     */
    maskChar?: string | null | undefined;
    maskPlaceholder?: string | null | undefined;
    /**
     * Show mask even in empty input without focus.
     */
    alwaysShowMask?: boolean | undefined;
    /**
     * Use inputRef instead of ref if you need input node to manage focus, selection, etc.
     */
    inputRef?: React.Ref<HTMLInputElement> | undefined;
    /**
     * In case you need to implement more complex masking behavior, you can provide
     * beforeMaskedStateChange function to change masked value and cursor position
     * before it will be applied to the input.
     *
     * * previousState: Input state before change. Only defined on change event.
     * * currentState: Current raw input state. Not defined during component render.
     * * nextState: Input state with applied mask. Contains value and selection fields.
     */
    beforeMaskedStateChange?(states: BeforeMaskedStateChangeStates): InputState;

    children?: (inputProps: any) => React.ReactNode;
};

export class ReactInputMask extends React.Component<Props> {
}

export default ReactInputMask;

````

### Additional Details
 * Last updated: Thu, 07 Nov 2024 23:02:44 GMT
 * Dependencies: [@types/react](https://npmjs.com/package/@types/react)

# Credits
These definitions were written by [Alexandre Paré](https://github.com/apare), [Dima Danylyuk](https://github.com/dima7a14), and [Lucas Rêgo](https://github.com/lucasraziel).

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