Always-fresh, extreme small & easy-to-use international phone masking with Google's libphonenumber data
Quick Start โข Packages โข Features โข Demo โข Contributing
Phone formats sync automatically from Google's libphonenumber โ no stale data, no manual updates. Just upgrade and you're current with global dialing rules.
Real market comparison, segmented by ecosystem and measured for what developers actually ship. Snapshot: 2026-03-27 (Bundlephobia API, Bundlephobia Exports API, npm Registry API).
Use Total gzip as the primary comparison column.
Gzip is Bundlephobia raw package gzip.
Data overhead is additional phone-data gzip excluded from raw package gzip (e.g. required peer engines). When available, export-level Bundlephobia sizes are used for better precision.
Total gzip = Gzip + Data overhead.
| Package | Last published | Phone data source | Data overhead | Gzip | Total gzip |
|---|---|---|---|---|---|
| @desource/phone-mask ยท Repo | 2026-03-25 | Included in package | 0.0 KB | 5.1 KB | 5.1 KB |
| libphonenumber-js ยท Repo | 2026-03-13 | Included in package | 0.0 KB | 43.7 KB | 43.7 KB |
| awesome-phonenumber ยท Repo | 2026-02-18 | Included in package | 0.0 KB | 75.4 KB | 75.4 KB |
| google-libphonenumber ยท Repo | 2026-01-19 | Included in package | 0.0 KB | 115.2 KB | 115.2 KB |
Best choice in Core (TypeScript/JavaScript): @desource/phone-mask (5.1 KB).
| Package | Last published | Phone data source | Data overhead | Gzip | Total gzip |
|---|---|---|---|---|---|
| @desource/phone-mask-react ยท Repo | 2026-03-25 | @desource/phone-mask (dep) | 0.0 KB | 9.2 KB | 9.2 KB |
| react-international-phone ยท Repo | 2026-02-21 | None | 0.0 KB | 9.4 KB | 9.4 KB |
| react-phone-input-2 ยท Repo | 2022-07-01 | Included in package | 0.0 KB | 17.1 KB | 17.1 KB |
| mui-tel-input ยท Repo | 2025-05-18 | libphonenumber-js (dep) | 0.0 KB | 45.8 KB | 45.8 KB |
| react-phone-number-input ยท Repo | 2026-02-23 | libphonenumber-js (dep) | 0.0 KB | 46.7 KB | 46.7 KB |
Best choice in React: @desource/phone-mask-react (9.2 KB).
React ecosystem note: react-international-phone removed built-in validation in v3 and recommends adding google-libphonenumber separately (migration doc). Raw package gzip above does not include that optional validator overhead.
| Package | Last published | Phone data source | Data overhead | Gzip | Total gzip |
|---|---|---|---|---|---|
| @desource/phone-mask-vue ยท Repo | 2026-03-25 | @desource/phone-mask (dep) | 0.0 KB | 10.5 KB | 10.5 KB |
| v-phone-input ยท Repo | 2026-03-11 | awesome-phonenumber (dep) | 0.0 KB | 15.0 KB | 15.0 KB |
| vue-tel-input ยท Repo | 2026-03-19 | libphonenumber-js (peer: parsePhoneNumberFromString) | 28.5 KB | 10.3 KB | 38.8 KB |
| vue-phone-number-input ยท Repo | 2022-09-20 | libphonenumber-js (dep) | 0.0 KB | 95.7 KB | 95.7 KB |
Best choice in Vue: @desource/phone-mask-vue (10.5 KB).
| Package | Last published | Phone data source | Data overhead | Gzip | Total gzip |
|---|---|---|---|---|---|
| @desource/phone-mask-svelte ยท Repo | 2026-03-25 | @desource/phone-mask (dep) | 0.0 KB | 11.1 KB | 11.1 KB |
| svelte-tel-input ยท Repo | 2026-03-26 | libphonenumber-js (dep) | N/A | N/A | N/A |
Best choice in Svelte: @desource/phone-mask-svelte (11.1 KB).
| Package | Last published | Phone data source | Data overhead | Gzip | Total gzip |
|---|---|---|---|---|---|
| @desource/phone-mask-nuxt ยท Repo | 2026-03-25 | @desource/phone-mask-vue (runtime: install) | 10.1 KB | 0.7 KB | 10.9 KB |
Best choice in Nuxt: @desource/phone-mask-nuxt (10.9 KB).
Nuxt ecosystem note: there are currently no widely adopted Nuxt-only phone input modules with stable npm + Bundlephobia signals comparable to React/Vue/Svelte peers; most Nuxt apps use Vue phone input packages directly.
Ready-made plugins for your stack:
| Package | Version | Description |
|---|---|---|
| @desource/phone-mask | Core library โ TypeScript/JS | |
| @desource/phone-mask-react | React component + hook | |
| @desource/phone-mask-vue | Vue 3 component + composable + directive | |
| @desource/phone-mask-svelte | Svelte 5 component + composable + action + attachment | |
| @desource/phone-mask-nuxt | Nuxt module |
npm install @desource/phone-mask-react
import { useState } from 'react';
import { PhoneInput } from '@desource/phone-mask-react';
import '@desource/phone-mask-react/assets/lib.css';
function App() {
const [phone, setPhone] = useState('');
return <PhoneInput value={phone} onChange={setPhone} country="US" />;
}
npm install @desource/phone-mask-vue
<script setup>
import { ref } from 'vue';
import { PhoneInput } from '@desource/phone-mask-vue';
import '@desource/phone-mask-vue/assets/lib.css';
const phone = ref('');
</script>
<template>
<PhoneInput v-model="phone" country="US" />
</template>
npm install @desource/phone-mask-svelte
<script lang="ts">
import { PhoneInput } from '@desource/phone-mask-svelte';
import '@desource/phone-mask-svelte/assets/lib.css';
let phone = $state('');
</script>
<PhoneInput bind:value={phone} country="US" />
npm install @desource/phone-mask-nuxt
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@desource/phone-mask-nuxt']
});
<script setup>
import { ref } from 'vue';
const phone = ref('');
</script>
<template>
<PhoneInput v-model="phone" country="US" />
</template>
npm install @desource/phone-mask
import { MasksFullMapEn, formatDigitsWithMap } from '@desource/phone-mask';
const mask = MasksFullMapEn.US.mask[0]; // "###-###-####"
const formatted = formatDigitsWithMap(mask, '2025551234').display;
// Result: "202-555-1234"
Try the interactive playground with:
We welcome contributions! Please see our Contributing Guide for details.
git clone https://github.com/YOUR_USERNAME/phone-mask.gitpnpm installgit checkout -b feature/my-featuregit commit -m "feat: add awesome feature"git push origin feature/my-feature# Install dependencies
pnpm install
# Build all packages
pnpm build
# Run unit tests with coverage report
pnpm test:unit:coverage
# Start demo dev server
pnpm dev:prepare
pnpm dev:demo
# Generate fresh data from Google's library
pnpm gen
Developed and maintained by DeSource Labs.
Created by Stefan Popov
MIT ยฉ 2026 DeSource Labs