Vue 3 International Telephone Input

1.0.4 · active · verified Sun Apr 19

vue3-tel-input is a Vue 3 component designed to provide an international telephone input field. It features an integrated country flag dropdown, automatic formatting, and adherence to international dialing standards. The current stable version is 1.0.4. While a specific release cadence isn't published, the project appears actively maintained with recent updates. A key differentiator is its explicit compatibility with Vue 3's composition API and global application setup, moving beyond older Vue versions. It supports both global plugin installation with default options and local component registration for fine-grained control, and requires a separate CSS import for styling. It allows filtering countries and setting preferred countries, making it flexible for various internationalization needs.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates both global registration and local component usage with `v-model` binding, preferred/only countries, and event handling for validation data.

import { createApp, ref } from 'vue';
import App from './App.vue';
import { VueTelInput } from 'vue3-tel-input';
import 'vue3-tel-input/dist/vue3-tel-input.css';

const app = createApp(App);

app.component('VueTelInput', VueTelInput);
app.mount('#app');

// In your App.vue or any other component:
// <template>
//   <div>
//     <h1>Enter Phone Number</h1>
//     <vue-tel-input
//       v-model="phoneNumber"
//       :preferredCountries="['US', 'CA']"
//       :onlyCountries="['US', 'CA', 'GB', 'DE', 'FR']"
//       :inputOptions="{ placeholder: 'Enter your phone number' }"
//       @update="onUpdate"
//     ></vue-tel-input>
//     <p v-if="phoneNumber">Current Number: {{ phoneNumber }}</p>
//     <p v-if="telInputInfo">Validation Info: {{ telInputInfo }}</p>
//   </div>
// </template>

// <script setup>
// import { ref } from 'vue';
// const phoneNumber = ref('');
// const telInputInfo = ref(null);

// const onUpdate = (payload) => {
//   phoneNumber.value = payload.number;
//   telInputInfo.value = payload;
//   console.log('Tel Input Update:', payload);
// };
// </script>

view raw JSON →