TextField Should Accept Phone numbers only how to validate it
Use @Pattern annotation if yours textField connected to some property or maskedField instead. Also you can read about textField validators.
In my opinion -
MaskedField is strong combination for stricted values like telephone numbers.
There is a library which has built-in rules and formats for most countries and is actively maintained:
But if you use it to strongly reject any phone number which does not comply libphonenumber formats - be ready to update the library periodically (e.g. at least once per year) and be prepared to “false positives”.
New phone prefixes, codes etc. appear very often. Phone number which is “invalid” today - a few months later may become used by mobile operators.