# @types/react-text-mask

> TypeScript definitions for react-text-mask

Latest version **5.4.14** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/react-text-mask
pnpm add @types/react-text-mask
yarn add @types/react-text-mask
bun add @types/react-text-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 | 5.4.14 |
| Published | 2023-11-07 |
| First published | 2018-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51441 |
| Maintainers | types |

## Links

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

## Dependencies (1)

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

## Recent versions

- 5.4.14 (latest) — 2023-11-07
- 5.4.11 (ts3.9) — 2021-12-24
- 5.4.8 (ts3.6) — 2021-07-07
- 5.4.7 (ts3.5) — 2021-04-08
- 5.4.6 (ts2.8) — 2019-06-07
- 5.4.0 (ts2.6) — 2018-05-18
- 5.4.13 — 2023-10-18
- 5.4.12 — 2023-09-27
- 5.4.10 — 2021-10-08
- 5.4.9 — 2021-08-04
- 5.4.5 — 2019-05-31
- 5.4.4 — 2019-02-13
- 5.4.3 — 2018-12-25
- 5.4.2 — 2018-08-25
- 5.4.1 — 2018-08-06
- … 2 more at https://npm.io/package/@types/react-text-mask/versions

## README

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

export type Mask = Array<string | RegExp> | false;

export interface PipeConfig {
    placeholder: string;
    placeholderChar: string;
    currentCaretPosition: number;
    keepCharPositions: boolean;
    rawValue: string;
    guide: boolean | undefined;
    previousConformedValue: string | undefined;
}

export type ConformToMaskConfig = Partial<Omit<PipeConfig, "rawValue">>;

export interface MaskedInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
    mask: Mask | ((value: string) => Mask);

    guide?: boolean;

    placeholderChar?: string;

    keepCharPositions?: boolean;

    pipe?: (
        conformedValue: string,
        config: PipeConfig,
    ) => false | string | { value: string; indexesOfPipedChars: number[] };

    showMask?: boolean;

    render?: (
        ref: (inputElement: HTMLElement) => void,
        props: {
            onChange: (event: React.ChangeEvent<HTMLElement>) => void;
            onBlur: (event: React.FocusEvent<HTMLElement>) => void;
            defaultValue: string | undefined;
        },
    ) => React.ReactNode;
}

export interface ConformToMaskResult {
    conformedValue: string;
    meta: {
        someCharsRejected: boolean;
    };
}

export default class MaskedInput extends React.Component<MaskedInputProps, any> {
    inputElement: HTMLElement;
}

export function conformToMask(
    text: string,
    mask: Mask | ((value: string) => Mask),
    config?: ConformToMaskConfig,
): ConformToMaskResult;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 09:09:39 GMT
 * Dependencies: [@types/react](https://npmjs.com/package/@types/react)

# Credits
These definitions were written by [Guilherme Hübner](https://github.com/guilhermehubner), [Deividi Cavarzan](https://github.com/cavarzan), and [Artem Lyubchuk](https://github.com/needpower).

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