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
country
Default country code, in ISO 3166-1 alpha-2 format.
Show exampleHide example
vue
disabled
Show exampleHide example
vue
error
An error message or boolean value indicating whether the input is in an error state.
Show exampleHide example
vue
format
When set to `national`, the country indicator is omitted.
Show exampleHide example
vue
height
The max height of the dropdown.
Show exampleHide example
vue
icon
Default icon used when no country is selected/detected.
Show exampleHide example
vue
item-height
The height of each dropdown item.
Show exampleHide example
vue
rounded
The radius of the input.
Show exampleHide example
vue
size
The size of the input.
Show exampleHide example
vue
Name
Emitted Value Type
@validation
Show exampleHide example
vue
@update:country
Show exampleHide example
vue
Name
Slot Prop Type
#country-label
Show exampleHide example
vue
#country-placeholder
Show exampleHide example
vue
#country-item
Show exampleHide example
vue
#action
Show exampleHide example
vue
Name
Type
validation
Show exampleHide example
vue
currentCountry
Show exampleHide example
vue
possibleCountries
Show exampleHide example
vue
filter
Show exampleHide example
vue
filterRef
Show exampleHide example
vue
dropdownRef
Show exampleHide example
vue
inputRef
Show exampleHide example
vue