1.5.3 • Published 2 years ago

vue-tel-input-vuetify v1.5.3

Weekly downloads
880
License
MIT
Repository
github
Last release
2 years ago

vue-tel-input-vuetify

International Telephone Input with Vuetify.

Table of Contents

Installation

Example Repository

You might want to follow and use the basic example usage of this library in this repository Example

OR try from scratch with below steps

vue-cli

  • create new vue project using vue-cli:
  vue create my-app
  cd my-app

vuetify

  • install vuetify to newly created vue project
  vue add vuetify

npm

  • install vue-tel-input-vuetify to newly created vue project
  npm install vue-tel-input-vuetify

Install the plugin into Vue:

With vuetify loader:

  // vue.config.js

  "transpileDependencies": [
    "vuetify",
    "vue-tel-input-vuetify"
  ]
  // src/plugins/vuetify.js

  import Vue from 'vue';
  import Vuetify from 'vuetify/lib';

  Vue.use(Vuetify);

  export default new Vuetify({
  });
// src/main.js

import Vue from 'vue';
import vuetify from "@/plugins/vuetify";
import VueTelInputVuetify from 'vue-tel-input-vuetify/lib';

Vue.use(VueTelInputVuetify, {
  vuetify,
});

new Vue({
  vuetify,
  render: (h) => h(App),
}).$mount("#app");

Without vuetify loader:

  // vue.config.js

  "transpileDependencies": [
    "vuetify",
    "vue-tel-input-vuetify"
  ]
  // src/plugins/vuetify.js

  import Vue from 'vue';
  import Vuetify from 'vuetify';
  import 'vuetify/dist/vuetify.min.css'

  Vue.use(Vuetify);

  export default new Vuetify({
  });
// src/main.js

import Vue from 'vue';
import VueTelInputVuetify from "vue-tel-input-vuetify";
import vuetify from "./plugins/vuetify";

Vue.use(VueTelInputVuetify, {
  vuetify,
});

new Vue({
  vuetify,
  render: (h) => h(App),
}).$mount("#app");

View all available options in Props.

Use the vue-tel-input-vuetify component:

<template>
  <vue-tel-input-vuetify v-model="phone"></vue-tel-input-vuetify>
</template>

<script>
export default {
  data() {
    return {
      phone: null
    }
  }
};
</script>

Usage

Props

PropertyTypeDefault valueDescription
messagesString | Array[]Displays a list of messages or message if using a string
success-messagesString | Array[]Puts the input in a success state and passes through custom success messages.
error-messagesString | Array[]Puts the input in an error state and passes through custom error messages. Will be combined with any validations that occur from the rules prop. This field will not trigger validation
hintStringundefinedHint text
suffixStringundefinedDisplays suffix text
prefixStringundefinedDisplays prefix text
background-colorStringundefinedChanges the background-color of the input
rulesStringArrayAccepts an array of functions that take an input value as an argument and return either true / false or a string with an error message
loader-heightNumber | String2Specifies the height of the loader
loadingString | BooleanfalseDisplays linear progress bar. Can either be a String which specifies which color is applied to the progress bar (any material color or theme color - primary, secondary, success, info, warning, error) or a Boolean which uses the component color (set by color prop - if it's supported by the component) or the primary color
hide-detailsString | BooleanundefinedHides hint and validation errors. When set to auto messages will be rendered only if there's a message (hint, error message, counter value etc) to display
clearableBooleanfalseAdd input clear functionality, default icon is Material Icons clear
filledBooleanfalseApplies the alternate filled input style
full-widthBooleanfalseDesignates input type as full-width
flatBooleanfalseRemoves elevation (shadow) added to element when using the solo or solo-inverted props
lightBooleanfalseApplies the light theme variant to the component.
validate-on-blurBooleanfalseDelays validation until blur event
denseBooleanfalseReduces the input height
outlinedBooleanfalseApplies the outlined style to the input
persistent-hintBooleanfalseForces hint to always be visible
readonlyBooleanfalsePuts input in readonly state
errorBooleanfalsePuts the input in a manual error state
successBooleanfalsePuts the input in a manual success state
shapedBooleanfalseRound if outlined and increase border-radius if filled. Must be used with either outlined or filled
single-lineBooleanfalseLabel does not move on focus/dirty
roundedBooleanfalseAdds a border radius to the input
valueany''The input's value
labelString'Enter a Phone Number'Native input 'label' attribute
selectLabelString''Country selector 'label' attribute
autocompleteString'on'Native input 'autocomplete' attribute
autofocusBooleanfalseNative input 'autofocus' attribute
defaultCountryString''Default country, will override the country fetched from IP address of user
disabledBooleanfalseDisable input field
disabledFetchingCountryBooleanfalseDisable fetching current country based on IP address of user
ignoredCountriesArray[]List of countries will NOT be shown on the dropdown. ie ['AU', 'BR']
inputIdString''Custom 'id' for the input
inputOptionsObject{ showDialCode: false, tabindex: 0 }Options for input, supporting showDialCode (always show dial code in the input) and tabindex
maxLenNumber25Native input 'maxlength' attribute
modeString''Format number to 'international' (with + dial code) or 'national' (with 0...)
nameString'telephone'Native input 'name' attribute
onlyCountriesArray[]List of countries will be shown on the dropdown. ie ['AU', 'BR']
placeholderString'Enter a phone number'Placeholder for the input
preferredCountriesArray[]Preferred countries list, will be on top of the dropdown. ie ['AU', 'BR']
requiredBooleanfalseRequired property for HTML5 required attribute
wrapperClassesString | Array | Object''Custom classes for the wrapper

Events

EventArgumentsDescriptionNotes
inputString, ObjectFires when the input changes with the argument is the object includes { number, isValid, country }onInput deprecated
validateObjectFires when the correctness of the phone number changes (from true to false or vice-versa) and when the component is mounted { number, isValid, country }onValidate deprecated
blurFires on blur eventonBlur deprecated
changeEmitted when the input is changed by user interaction
clickEmitted when input is clicked
focusEmitted when component is focused
keydownEmitted when any key is pressed
mousedownEmitted when click is pressed
mouseupEmitted when click is released
blurFires on blur eventonBlur deprecated
spaceFires on keyup.space eventonSpace deprecated
enterFires on keyup.enter eventonEnter deprecated
openFires when the flags dropdown opens
closeFires when the flags dropdown closes
country-changedObjectFires when country changed (even for the first time)

Credits & Contributors

Credits

made with by Yoga.

1.5.3

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.2.17

3 years ago

1.3.0

3 years ago

1.2.16

3 years ago

1.2.15

4 years ago

1.2.14

4 years ago

1.2.13

4 years ago

1.2.12

4 years ago

1.2.11

4 years ago

1.2.10

4 years ago

1.2.9

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.9

4 years ago

1.1.10

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.1

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.11

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago