Getting Started
Installation
- npm
- yarn
- pnpm
npm install react-international-phone
yarn add react-international-phone
pnpm add react-international-phone
Basic usage
import { useState } from 'react';
import { PhoneInput } from 'react-international-phone';
import 'react-international-phone/style.css';
const App = () => {
const [phone, setPhone] = useState('');
return (
<div>
<PhoneInput
defaultCountry="ua"
value={phone}
onChange={(phone) => setPhone(phone)}
/>
</div>
);
};
note
Don't forget to import default styles when using UI components
import 'react-international-phone/style.css';