Skip to content

PhoneInput: full country list + basic E.164 validation #32

Open

Description

@sapatmohit

PhoneInput: full country list + basic E.164 validation

PhoneInput currently ships 50 countries, so users in most of the world (e.g. Sri Lanka, Nepal, Peru, Morocco, Ukraine) can't select their dial code.

Proposal

  1. Full list — all ITU-T E.164 country codes (~245 entries). Flags can be derived from the ISO code rather than stored, and English names via Intl.DisplayNames to keep bundle size down.
  2. Optional countries prop — allow consumers to restrict / reorder the list (e.g. ["IN", "US", "GB"]), plus preferredCountries pinned at the top.
  3. Basic validation — strip formatting characters, enforce digits-only and E.164 max length (15 digits incl. country code); expose aria-invalid and an onValidityChange(valid, e164) callback. Full per-country rules (libphonenumber) stay out of scope to keep zero extra deps.

Acceptance

  • Test that every entry has a valid ISO code and +-prefixed dial code
  • Tests for countries filtering and validation callback
  • Bundle size noted in the PR

Activity

  1. ujwalbajaj commented on Oct 28, 2026

    @ujwalbajaj
    Collaborator

    Hey @sapatmohit, I am interested to work on this, so can you just assign this issue to me!?

  2. sapatmohit commented on Oct 28, 2026

    @sapatmohit
    MemberAuthor

    Its yours man, go ahead!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions