UsePhoneInputResult
Properties
Section titled “Properties”clear: () => void;Empty the number, keeping the selected country. Present on every input hook in the suite.
Returns
Section titled “Returns”void
countries
Section titled “countries”countries: Country[];The list the picker should show, in order.
country
Section titled “country”country: | Country | undefined;The currently selected country.
details
Section titled “details”details: PhoneDetails;Everything onChange reports.
disabled
Section titled “disabled”disabled: boolean;flagFor
Section titled “flagFor”flagFor: (iso2) => string;Flag emoji for an ISO code.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
iso2 | string |
Returns
Section titled “Returns”string
handleBlur
Section titled “handleBlur”handleBlur: (event) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | FocusEvent<HTMLElement> |
Returns
Section titled “Returns”void
handleFocus
Section titled “handleFocus”handleFocus: (event) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | FocusEvent<HTMLElement> |
Returns
Section titled “Returns”void
handleInputChange
Section titled “handleInputChange”handleInputChange: (event) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | ChangeEvent<HTMLInputElement> |
Returns
Section titled “Returns”void
ids: object;hidden
Section titled “hidden”hidden: string;input: string;label: string;Only referenced when label is a node rather than a string.
root: string;select
Section titled “select”select: string;validity
Section titled “validity”validity: string;inputRef
Section titled “inputRef”inputRef: object;Structural rather than RefObject: in @types/react 18 RefObject.current
is readonly, in 19 it is mutable. Declaring the shape keeps this assignable
under both, which matters because react >= 18 is a peer.
current
Section titled “current”current: HTMLInputElement | null;international
Section titled “international”international: boolean;True when the user is typing an explicit +… number.
maxLength
Section titled “maxLength”maxLength: number;The character cap after coercion. Always set — an unusable value falls back
to the default. Put it on your own <input> when rendering headless; the
hook enforces it either way.
nameFor
Section titled “nameFor”nameFor: (iso2) => string;Localised country name, from Intl.DisplayNames.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
iso2 | string |
Returns
Section titled “Returns”string
readOnly
Section titled “readOnly”readOnly: boolean;selectCountry
Section titled “selectCountry”selectCountry: (iso2) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
iso2 | string |
Returns
Section titled “Returns”void
text: string;What the input displays — grouped, and carrying + in international mode.
touched
Section titled “touched”touched: boolean;Focus has left the whole field at least once. Feedback about a number being the wrong length is only fair after that: every number is “too short” while it is still being typed.
value: string;The canonical value: + + calling code + national digits, or ''.