Ready to use phone input component with country code dropdown, with validation and formatting. The component extend the <BaseInput> component, so you can use all the props and events of the base component.
Show codeHide code
vue
The component provides a country dropdown to select the country code, you can use the country prop to set the default country, otherwise it will be detected from the user's input.
You can use the v-model:country notation to get the selected/detected country code.
Show codeHide code
vue
By default, the input value will be formatted in the international format, you can change this behavior with the format prop to change it to national.
Show codeHide code
vue
The component provides a @validation event to indicate if the input value is valid or not
Show codeHide code
vue
Show codeHide code
vue
Show codeHide code
vue
Show codeHide code
vue
Name
Type
countryDefault country code, in ISO 3166-1 alpha-2 format.
Show exampleHide example
vue
disabledShow exampleHide example
vue
errorAn error message or boolean value indicating whether the input is in an error state.
Show exampleHide example
vue
formatWhen set to `national`, the country indicator is omitted.
Show exampleHide example
vue
heightThe max height of the dropdown.
Show exampleHide example
vue
iconDefault icon used when no country is selected/detected.
Show exampleHide example
vue
item-heightThe height of each dropdown item.
Show exampleHide example
vue
roundedThe radius of the input.
Show exampleHide example
vue
sizeThe size of the input.
Show exampleHide example
vue
Name
Emitted Value Type
@validationShow exampleHide example
vue
@update:countryShow exampleHide example
vue
Name
Slot Prop Type
#country-labelShow exampleHide example
vue
#country-placeholderShow exampleHide example
vue
#country-itemShow exampleHide example
vue
#actionShow exampleHide example
vue
Name
Type
validationShow exampleHide example
vue
currentCountryShow exampleHide example
vue
possibleCountriesShow exampleHide example
vue
filterShow exampleHide example
vue
filterRefShow exampleHide example
vue
dropdownRefShow exampleHide example
vue
inputRefShow exampleHide example
vue