jorisre / react-telephone

☎️ Tiniest react phone input component (auto formating included)
https://react-telephone.joris.re/
MIT License
44 stars 6 forks source link
phone phone-number phonenumber react reactjs

react-telephone - Demo

All Contributors


☎️ react-telephone

Tiniest react input phone component (auto formating included)


Demo · Documentation · Twitter Created by Joris

Features

Examples (Demo)

Installation

yarn add react-telephone

or

npm i react-telephone

Usage

import { Phone } from 'react-telephone';

export default function MyComponent() {
  return (
    <Phone>
      <Phone.Country />
      <Phone.Number />
    </Phone>
  );
}

Props

Prop Description Default Value
defaultCountry Default country displayed for the country selector First country (Afghanistan) Country ISO2 code (fr, us)

Utils

Name Description
countries List of all countries.
getCountryByIso Returns the country object for a given ISO code.
applyMask Apply the mask to a given phone number.
splitPhoneNumber Split a phone number into country code and number.
replaceDialCode Replace the dial code of a phone number.

Contributors

Thanks goes to these wonderful people (emoji key):

Joris
Joris

💻 📖 🤔 👀
Michaël Rézac
Michaël Rézac

🤔 💻
Varshneya Rao
Varshneya Rao

💻