Components
PhoneInput
Phone number input with an integrated country selector, built on
react-phone-number-input; emits E.164-formatted values via onChange.
Usage
Best practices
onChangeemits an E.164 string (e.g.+15550000000) orundefinedwhile the number is incomplete/cleared - store that shape, don't reformat the raw text yourself.Set
defaultCountry(ISO alpha-2, default"US") for the initial calling code; the integrated country selector then lets users switch.Validate the emitted E.164 value (e.g. via react-phone-number-input's
isValidPhoneNumber) rather than regex-matching the display text.
Props
Also exports
- type
E164Number - type
PhoneInputProps
Composition
Builds on