Socket
Socket
Sign inDemoInstall

vue-phone-number-input

Package Overview
Dependencies
13
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-phone-number-input

A phone number input made with Vue JS && libphonenumber-js


Version published
Weekly downloads
16K
increased by0.6%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

vue-phone-number-input

A beautiful text field to format phone numbers made with VueJS

vue-phone-number-input

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)
  • Use browser locale to set the country calling code (can be disabled & you can use default-country-code option)
  • 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
  • Differents size of input (sm or lg)
  • You can disable the flags - no-flags props
  • Dark UI option
  • Disabled option
  • Set your translations

Props API

PropsTypeRequiredDefault
v-modelString/Inttrue-
idStringfalseVuePhoneNumberInput
colorString HEXnodogderblue
valid-colorString HEXnoyellowgreen
sizeString `smlg`no
default-country-code (1)Stringnonull
preferred-countries (2)Array<string>nonull
ignored-countriesArray<string>nonull
only-countriesArray<string>nonull
no-validator-stateBooleannofalse
no-use-browser-localeBooleannofalse
no-flagsBooleannofalse
disabledBooleannofalse
darkBooleannofalse
requiredBooleannofalse
errorBooleannofalse
translations (3)Objectnonull

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

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

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

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

Keyboard accessibility

PropsAction
ArrowDownNavigation down in countries list
ArrowUpNavigation up in countries list
EscapeClose countries list
All letters charactersSearching country name in countries list (should be open)

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

Keywords

FAQs

Last updated on 04 May 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc