Skip to content

Phone Input

Allows users to enter international phone numbers with automatic country flag detection, dial codes, and formatted digits.

8.1 KB
•
Updated on September 5, 2026

We used the react-phone-number-input library to create this component.

Installation

Bash

Usage

Code
Code

Examples

Size

API Reference

PhoneInput

The main component for entering phone numbers with country selection.


Utilities

The component re-exports essential phone number utilities:

Code
  • isValidPhoneNumber(value): Checks if the phone number is valid according to international metadata.
  • formatPhoneNumber(value): Formats the phone number in national format.
  • formatPhoneNumberIntl(value): Formats the phone number in international format (e.g. +1 213 373 4253).
  • isPossiblePhoneNumber(value): Quick length check to see if the number could be possible.
  • getCountryCallingCode(country): Returns the calling code for a given ISO country code (e.g. 'FR' -> '33').

External Props

This component also accepts all props from the react-phone-number-input library.

Examples

Large phone input

Disabled phone input

Phone input with preset value

Phone input with error state

Phone input with specific default country

Read-only phone input

Real-time validation

With Field, Label and Description

Keep in mind

  • MIT License: Free and open-source for personal and commercial use. Feel free to copy, tweak, and adapt the components to match your exact needs.
  • Credits & Inspiration: Some components on this site are inspired by or recreated from great ideas across the web. I'm not here to take credit; just to learn, experiment, and push interface craft further.
  • Reach out & Claims: If an attribution was missed, or if you have any inquiry or claim, feel free to reach out directly on X to @adrielzimbril. I'll be glad to update or resolve it right away.