react-int-phone-input
v0.1.5
Published
International phone number input for react with UX consideration.
Downloads
41
Maintainers
Readme
React-Int-Phone-Input
A lightweight React international phone number input with taking UX in consideration
Live Demo
Demo
Installation
npm install react-int-phone-input --save
Usage
import React, {useState} from 'react';
import PhoneNumberInput from 'react-int-phone-input';
const App = () => {
const [value, setValue] = useState();
return (
<PhoneInput
value={value}
onChange={setValue}
/>
)
}
- Default country
You can set the default selected country by using defaultCountry
import React, {useState} from 'react';
import PhoneNumberInput from 'react-int-phone-input';
const App = () => {
const [value, setValue] = useState();
return (
<PhoneInput
value={value}
onChange={setValue}
defaultCountry={'GB'}
/>
)
}
Props
| Name | Type | Description | Default | Example | |-----------------|---------|--------------------------------------|---------|---------| | showCountryCode | Boolean | To render the country code in the UI | true | false | | defaultCountry | string | initial country | 'US' | 'US' |