Use custom masks and area codes
masterYou can define specific input masks and area codes for certain countries.
Custom Masks
Use the masks prop to provide a mapping of country codes to mask patterns.
Custom Area Codes
Use the areaCodes prop to provide a mapping of country codes to arrays of valid area codes.
Local Area Codes
Enable local area code support using enableAreaCodes. You can pass an array of country codes to limit this feature to specific countries and use enableAreaCodeStretch to prevent the mask from stretching to the full length of the area code section.
<PhoneInput
onlyCountries={['fr', 'at']}
masks={{fr: '(...) ..-..-..', at: '(....) ...-....'}}
/>
<PhoneInput
enableAreaCodes={true}
enableAreaCodes={['us', 'ca']}
enableAreaCodeStretch
/>
<PhoneInput
onlyCountries={['gr', 'fr', 'us']}
areaCodes={{gr: ['2694', '2647'], fr: ['369', '463'], us: ['300']}}
/>