Vue Tel Input is a Vue.js component that provides an international telephone input field, integrating country code selection, formatting, and validation. It leverages `libphonenumber-js` for robust and accurate parsing, formatting, and validation of phone numbers according to international standards. The current stable version is `9.8.0`, with regular minor and patch releases addressing bugs, improving features like TypeScript support, accessibility, and updating underlying dependencies. Key differentiators include its dedicated Vue 3 support (with a separate legacy branch for Vue 2), flexible installation options (global plugin, local component, or lazy loading for performance), and comprehensive customization capabilities for styling and behavior. It offers a standardized solution for handling diverse international phone number inputs in web applications.
npm install vue-tel-inputVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of `vue-tel-input` as a local component within a Vue 3 setup script, binding its value to a reactive reference and importing the necessary styles.
Run `npm install libphonenumber-js vue` in your project directory.
Update to `vue-tel-input@9.8.0` or higher to ensure correct and complete TypeScript exports. If using an older version, you might need to add `skipLibCheck: true` to your `tsconfig.json` as a temporary workaround, though this is not recommended.
Ensure you are using `import 'vue-tel-input/vue-tel-input.css';` for styles. Avoid deprecated or incorrect paths like `vue-tel-input/dist/vue-tel-input.css`.
Follow the lazy loading example in the official documentation, ensuring both `import('vue-tel-input')` and `import('vue-tel-input/vue-tel-input.css')` are part of the asynchronous loading process, and avoid `<style>` tags for component CSS in such scenarios.`npm install libphonenumber-js`
Use the default import for global registration: `import VueTelInput from 'vue-tel-input'; app.use(VueTelInput);`
Update your CSS import statement to: `import 'vue-tel-input/vue-tel-input.css';`
Ensure Vue is loaded before `vue-tel-input` for automatic installation. If installing manually, verify the global variable name and that the plugin object has an `install` method.