# react-phone-hooks

> React hooks and utility functions for parsing and validating phone numbers.

Latest version **0.1.22** (published 2026-03-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-phone-hooks
pnpm add react-phone-hooks
yarn add react-phone-hooks
bun add react-phone-hooks
```

## Health

**Score 55/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.1.22 |
| Published | 2026-03-17 |
| First published | 2023-12-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Maintainers | ar_tyom2000 |
| Keywords | react, phone, input, hooks, number, parsing, utilities, validation |

## Links

- npm: https://www.npmjs.com/package/react-phone-hooks
- Repository: https://github.com/typesnippet/react-phone-hooks
- Issues: https://github.com/typesnippet/react-phone-hooks/issues
- npm.io page: https://npm.io/package/react-phone-hooks

## 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.1.22 (latest) — 2026-03-17
- 0.1.21 — 2025-12-24
- 0.1.20 — 2025-12-01
- 0.1.19 — 2025-11-23
- 0.1.18 — 2025-11-01
- 0.1.17 — 2025-10-31
- 0.1.16 — 2025-07-25
- 0.1.15 — 2025-07-01
- 0.1.14 — 2025-02-03
- 0.1.13 — 2025-02-03
- 0.1.12 — 2024-11-13
- 0.1.11 — 2024-09-03
- 0.1.10 — 2024-08-05
- 0.1.9 — 2024-07-21
- 0.1.8 — 2024-07-20
- … 10 more at https://npm.io/package/react-phone-hooks/versions

## README

# react-phone-hooks <img src="https://github.com/typesnippet.png" align="right" height="64" />

[![npm](https://img.shields.io/npm/v/react-phone-hooks)](https://www.npmjs.com/package/react-phone-hooks)
[![React](https://img.shields.io/badge/react-%E2%89%A516-blue)](https://www.npmjs.com/package/react-phone-hooks)
[![types](https://img.shields.io/npm/types/react-phone-hooks)](https://www.npmjs.com/package/react-phone-hooks)
[![License](https://img.shields.io/npm/l/react-phone-hooks)](https://github.com/typesnippet/react-phone-hooks/blob/master/LICENSE)
[![Tests](https://github.com/typesnippet/react-phone-hooks/actions/workflows/tests.yml/badge.svg)](https://github.com/typesnippet/react-phone-hooks/actions/workflows/tests.yml)

This comprehensive toolkit features custom hooks and utility functions tailored for phone number formatting, parsing,
and validation. It supports international standards, making it suitable for phone number processing applications across
different countries and regions.

## Usage

This library can be used to build a phone number input component with a country selector for React applications. As well
as to parse the phone metadata, validate phone numbers, format raw phone numbers into a more readable format and the
opposite. You can use the [development](./development) to test and develop your own components.

```jsx
import {getFormattedNumber, getMetadata, parsePhoneNumber, useMask} from "react-phone-hooks";

getFormattedNumber("440201111111"); // +44 (02) 011 11111
getMetadata("440201111111"); // ["gb", "United Kingdom", "44", "+44 (..) ... ....."]
parsePhoneNumber("+44 (02) 011 11111"); // {countryCode: 44, areaCode: "02", phoneNumber: "01111111", isoCode: "gb"}

const PhoneInput = (props) => {
    return <input {...useMask("+1 (...) ... ....")} {...props}/>
}
```

## Contribute

Any contribution is welcome. Don't hesitate to open an issue or discussion if you have questions about your project's
usage and integration. For ideas or suggestions, please open a pull request. Your name will shine on our contributors'
list. Be proud of what you build!

## License

Copyright (C) 2023 Artyom Vancyan. [MIT](https://github.com/typesnippet/react-phone-hooks/blob/master/LICENSE)

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