Tiniest react input phone component (auto formating included)
Demo · Documentation · Twitter Created by Joris
Phone.Country
and Phone.Number
: coming soonyarn add react-telephone
or
npm i react-telephone
import { Phone } from 'react-telephone';
export default function MyComponent() {
return (
<Phone>
<Phone.Country />
<Phone.Number />
</Phone>
);
}
Prop | Description | Default | Value |
---|---|---|---|
defaultCountry |
Default country displayed for the country selector | First country (Afghanistan) | Country ISO2 code (fr, us) |
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. |
Thanks goes to these wonderful people (emoji key):
Joris 💻 📖 🤔 👀 |
Michaël Rézac 🤔 💻 |
Varshneya Rao 💻 |