The `intl-tel-input` library is a robust JavaScript plugin designed for entering, formatting, and validating international telephone numbers. Currently at version 27.0.11, it maintains an active release cadence with frequent bug fixes and feature enhancements, including recent updates for React, Vue, and Svelte components, and fixes for TypeScript type resolution. Key differentiators include automatic country detection via IP lookup, placeholder examples for selected countries, keyboard navigation for the country dropdown, real-time number formatting, and comprehensive validation powered by Google's libphonenumber library. It provides high-resolution flag images, includes TypeScript definitions, and supports extensive customization through options, methods, events, and CSS variables for theming.
npm install intl-tel-inputVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes the international telephone input plugin on an HTML input element. It configures basic options like initial and preferred countries, loads the essential utility script for validation, and demonstrates how to handle country changes and validate the entered phone number.
Migrate component usage from `<IntlTelInput initOptions={{ initialCountry: 'us' }} />` to `<IntlTelInput initialCountry='us' />`.Update any code relying on specific fields from `getSelectedCountryData()` or the `countrychange` event to only use the `name`, `iso2`, or `dialCode` properties.
Ensure `iti.loadUtils('/path/to/utils.js')` is called and its promise resolves before attempting to use validation-related methods. The `utils.js` file is typically found in `node_modules/intl-tel-input/build/js/utils.js` or available via CDN.Update to version 27.0.8 or newer. If upgrading is not possible, review custom CSS, especially `padding-left` properties and flexbox/grid overrides, for potential conflicts.
Call `intlTelInputInstance.loadUtils('/path/to/utils.js')` and ensure its promise resolves before invoking validation methods. For example: `iti.loadUtils('...').then(() => { if (iti.isValidNumber()) { ... } })`.For modern JavaScript modules, use `import intlTelInput from 'intl-tel-input';`. For CommonJS, use `const intlTelInput = require('intl-tel-input');`. For global usage, ensure the script tag for `intl-tel-input.min.js` is present in your HTML before your custom script.Ensure you are using `import 'intl-tel-input/styles';` (recommended since v27.0.8). If this still fails or you're on an older version, try `import 'intl-tel-input/build/css/intlTelInput.css';`.
No dependency data recorded yet.