Open software-trizzey opened 3 years ago
I with make a common input component with pattern prop to validate any other things. Example:
Input component to validate North American phone is:
<my-input placeholder="Input North American phone number" pattern="^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$" size="large"> </my-input>
Input component to validate International phone is:
<my-input placeholder="Input International phone number" pattern="^\+(?:[0-9] ?){6,14}[0-9]$" size="large"> </my-input>
@thucpn Go for it 💪🏻
@r4pt0s I have made a PR for this issue: https://github.com/zero-to-mastery/WebBlocks/pull/38
Are you sick and tired of having to recreate a form field that can handle and validate telephone numbers?
Yeah, us too.
Therefore, we would like our library to include a Telephone component that only accepts text matching a particular set of standard telephone formats.
Example:
The more flexible this component is the better. This ideally means we would like to see it support multiple telephone formats and not just North American.
This webpage might be a helpful guide https://developers.google.com/style/phone-numbers.