All Projects → LouisMazel → Vue Phone Number Input

LouisMazel / Vue Phone Number Input

Licence: mit
A phone number input made with Vue JS (format & valid phone number)

Projects that are alternatives of or similar to Vue Phone Number Input

PhoneNumberKit
Android Kotlin library to parse and format international phone numbers. Country code picker.
Stars: ✭ 124 (-69.53%)
Mutual labels:  phone-number, phone, number
React Phone Input 2
📞 Highly customizable phone input component with auto formatting
Stars: ✭ 446 (+9.58%)
Mutual labels:  phone, input, number
React Native Phone Input
Phone input box for React Native
Stars: ✭ 356 (-12.53%)
Mutual labels:  phone, input
international-telephone-input
Integration to Magento 2 a jQuery plugin for entering and validating international telephone numbers.
Stars: ✭ 26 (-93.61%)
Mutual labels:  input, phone-number
numberbox-card
Replace input_number sliders with plus and minus buttons
Stars: ✭ 61 (-85.01%)
Mutual labels:  input, number
Phonia
Phonia Toolkit is one of the most advanced toolkits to scan phone numbers using only free resources. The goal is to first gather standard information such as country, area, carrier and line type on any international phone numbers with a very good accuracy.
Stars: ✭ 221 (-45.7%)
Mutual labels:  phone, phone-number
Moriarty Project
This tool gives information about the phone number that you entered.
Stars: ✭ 223 (-45.21%)
Mutual labels:  phone, phone-number
yup-phone
☎️ Adds a phone number validation check to yup validator using google-libphonenumber
Stars: ✭ 219 (-46.19%)
Mutual labels:  phone, number
React Phone Number Input
React component for international phone number input
Stars: ✭ 725 (+78.13%)
Mutual labels:  phone, number
react-numeric
A react component for formatted number form fields
Stars: ✭ 30 (-92.63%)
Mutual labels:  input, number
react-headless-phone-input
Headless phone number input component for React. Because phone numbers are hard.
Stars: ✭ 25 (-93.86%)
Mutual labels:  input, phone-number
intl-tel-input-rails
intl-tel-input for the Rails asset pipeline
Stars: ✭ 35 (-91.4%)
Mutual labels:  input, phone-number
Libphonenumber Js
A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript
Stars: ✭ 2,233 (+448.65%)
Mutual labels:  phone, number
Mini phone
A fast phone number lib for Ruby (binds to Google's C++ libphonenumber)
Stars: ✭ 131 (-67.81%)
Mutual labels:  phone, phone-number
phonenumber
With a given country and phone number, validate and format the MOBILE phone number to E.164 standard
Stars: ✭ 108 (-73.46%)
Mutual labels:  phone, number
Crboxinputview
Verify code input view. Support security type for password.短信验证码输入框,支持密文模式
Stars: ✭ 749 (+84.03%)
Mutual labels:  phone, phone-number
getcontact
Find info about user by phone number using GetContact API
Stars: ✭ 228 (-43.98%)
Mutual labels:  phone-number, phone
Phone
With a given country and phone number, validate and reformat the mobile phone number to the E.164 standard. The purpose of this is to allow us to send SMS to mobile phones only.
Stars: ✭ 531 (+30.47%)
Mutual labels:  phone, phone-number
ember-phone-input
An Ember.js component to handle international phone numbers
Stars: ✭ 22 (-94.59%)
Mutual labels:  input, phone-number
haoma
手机固话电话号码标记批量查询📞📌
Stars: ✭ 52 (-87.22%)
Mutual labels:  phone-number, phone

vue-phone-number-input

license vue 2 npm npm Codacy grade

npm

A beautiful text field to format phone numbers made with VueJS

vue-phone-number-input


NEW VERSION ON MY NEW LIBRARY: MAZ-UI

The new version of VuePhoneNumberInput is now on my new library Maz-UI

See doc/demo page of MazPhoneNumberInput

Some options may change, check the props documentation with the top right button

In this new library, you can enjoy lot of others components in the same style. You can just install the component you want (and not the whole library), for this Read the Get started page

If you have any problem or question, do no hesitate to ask me !


Demo

Enjoy

Installation

Using yarn

yarn add vue-phone-number-input

Using npm

npm i --save vue-phone-number-input

Usage

ES6 Modules / CommonJS

import VuePhoneNumberInput from 'vue-phone-number-input';
import 'vue-phone-number-input/dist/vue-phone-number-input.css';

Vue.component('vue-phone-number-input', VuePhoneNumberInput);
<VuePhoneNumberInput v-model="yourValue" />

UMD

<VuePhoneNumberInput v-model="yourValue" />

<script src="https://unpkg.com/vue" charset="utf-8"></script>
<script src="./dist/vue-phone-number-input.umd.min.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="./dist/vue-phone-number-input.css">

<script type="text/javascript">
  Vue.component('vue-phone-number-input', window.VuePhoneNumberInput.default);
</script>

Features List

  • You can set preferred-countries, ignored-countries or have only-countries
  • Validator State: input becomes green (you can modify this color with valid-color option) when the phone number is valid (can be disabled by no-validator-state attr)
  • Multi options to getting country code : By default the component get the country code via the browser (disable it with no-use-browser-locale) or you can use fetch-country to get the country code via https://ip2c.org/s (network needed) - you can use default-country-code option instead to set one
  • Phone number formatting while typing
  • You can search your country in list (open countries list & type your country name)
  • Keyboard accessibility (Arrow down, Arrow up: Countries list navigation - Escape: Close countries list)
  • Phone number example for each country in placeholder/label
  • Auto focus phone number input after selecting country
  • You can disable the flags - no-flags props
  • Set your translations

All options of VueInputUi are available

  • Differents size of input (sm or lg) size="sm|lg"
  • Disabled option (disabled prop)
  • Dark UI option (dark prop)
  • Active a clear button by the prop clearable (cf: VueInputUi options)
  • Active a loader progress bar by the prop loader (cf: VueInputUi options)
  • And others

Props API

Props Type Required Default
v-model String/Int true -
id String false VuePhoneNumberInput
color String HEX no dogderblue
valid-color String HEX no yellowgreen
error-color String HEX no orangered
size String `sm lg` no
default-country-code (1) String no null
preferred-countries (2) Array<string> no null
ignored-countries Array<string> no null
only-countries Array<string> no null
no-validator-state Boolean no false
no-flags Boolean no false
disabled Boolean no false
dark Boolean no false
dark-color String (hex) no #424242
required Boolean no false
error Boolean no false
clearable Boolean no false
loader (3) Boolean no false
translations (4) Object no null
countries-height (5) Number no 30
no-use-browser-locale (6) Boolean no false
fetch-country (7) Boolean no false
no-country-selector (8) Boolean no false
border-radius Number no 4
show-code-on-list Boolean no false
no-example Boolean no false

(1) Ex : default-country-code="FR"

(2) Ex : preferred-countries="['FR', 'BE', 'DE']" This countries will be at the top of the list

(3) Loader progress bar has the input color (color props)

(4) translations comes to replace default texts - Ex :

translations="{
  countrySelectorLabel: 'Code pays',
  countrySelectorError: 'Choisir un pays',
  phoneNumberLabel: 'Numéro de téléphone',
  example: 'Exemple :'
}"

(5) height in px of the rows included in the dropdown. Ex: countries-height: 40

(6) By default the component get country code via browser - No network needed but not work on SSR with NuxtJS (disable it with no-use-browser-locale)

(7) Fetch country code via https://ip2c.org/s - Network needed - (Do not use it with default-country-code options)

(8) The country selector is not shown, you can validate your phone number with the country code set

Events API

Event Return
phone-number-focused - (emit when phone number input is focused)
phone-number-blur - (emit when phone number input is blur)
input AsYouType value (emit when new value is enter on phone number input && when a country is choosed)
update All values (cf values in table on demo) (emit when new value is enter on phone number input && when a country is choosed)

Keyboard accessibility

Props Action
ArrowDown Navigation down in countries list
ArrowUp Navigation up in countries list
Escape Close countries list
All letters characters Searching country name in countries list (should be open)

Named slots

Slot Action
arrow Override the default arrow character for toggling the list of countries

Contribution

Project setup

npm install

Compiles and hot-reloads for development

npm run serve

Lints and fixes files

npm run lint

License

This project is licensed under MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].