https://github.com/typesnippet/react-phone-hooks
React hooks and utility functions for parsing and validating phone numbers.
https://github.com/typesnippet/react-phone-hooks
hacktoberfest hooks input number parsing phone react utilities validation
Last synced: 2 months ago
JSON representation
React hooks and utility functions for parsing and validating phone numbers.
- Host: GitHub
- URL: https://github.com/typesnippet/react-phone-hooks
- Owner: typesnippet
- License: mit
- Created: 2023-11-30T16:31:33.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2026-03-29T20:04:12.000Z (3 months ago)
- Last Synced: 2026-03-29T21:34:11.270Z (3 months ago)
- Topics: hacktoberfest, hooks, input, number, parsing, phone, react, utilities, validation
- Language: TypeScript
- Homepage:
- Size: 1.14 MB
- Stars: 8
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-phone-hooks 
[](https://www.npmjs.com/package/react-phone-hooks)
[](https://www.npmjs.com/package/react-phone-hooks)
[](https://www.npmjs.com/package/react-phone-hooks)
[](https://github.com/typesnippet/react-phone-hooks/blob/master/LICENSE)
[](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
}
```
## 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)