You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5c6cbef
Browse filesBrowse the repository at this point in the historyBrowse files
PhoneInput: full ITU-T E.164 country list + basic validation
Expand the built-in country list from 50 to all 244 ITU-T E.164
entries. English names are derived at load from Intl.DisplayNames and
flags from the ISO code's regional-indicator symbols, so neither is
stored in the bundle; the original 50 keep their order, with the rest
appended A-Z.
Add preferredCountries (pinned above a divider, unioned into the menu)
and accept bare ISO strings in countries. Add opt-in basic E.164
validation: validate marks a malformed non-empty number aria-invalid and
onValidityChange(valid, e164) reports the normalized value. No new
dependency; country table lives inside the component.
Closes#32
Copy file name to clipboardExpand all lines: content/docs/components/inputs/phone-input.mdx
+75-25Lines changed: 75 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Phone Input
3
-
description: International phone number input with country selector, flag emojis, and dial code search. Supports 50 countries with built-in formatting and validation.
3
+
description: International phone number input with country selector, flag emojis, and dial code search. Covers every E.164 country (~244 entries) with optional E.164 validation.
|`value`|`string`| No | Phone number — pass this to control the component |
198
+
|`defaultValue`|`string`| No | Initial phone number when uncontrolled |
199
+
|`onValueChange`|`(phone: string, country: Country) => void`| No | Callback when phone number or country changes |
200
+
|`country`|`string`| No | Selected country code (ISO 3166-1 alpha-2) — pass this to control the country |
201
+
|`onCountryChange`|`(country: Country) => void`| No | Callback when the selected country changes — from the menu or dial-code detection |
202
+
|`validate`|`boolean`| No | Mark the input `aria-invalid` when a non-empty number is malformed (default: `false`) |
203
+
|`onValidityChange`|`(valid: boolean, e164: string) => void`| No | Callback with basic E.164 validity and the normalized number, whenever the digits change |
204
+
|`defaultCountry`|`string`| No | Initial country code when uncontrolled (ISO 3166-1 alpha-2, e.g. `"US"`, `"GB"`, `"IN"`; default: `"US"`) |
205
+
|`countries`|`(Country \| string)[]`| No | Countries offered, in display order; entries are `Country` objects or ISO codes (default: `COUNTRIES`) |
206
+
|`preferredCountries`|`(Country \| string)[]`| No | Countries pinned above a divider at the top; added even when not in `countries`, and deduplicated |
207
+
|`placeholder`|`string`| No | Placeholder text |
208
+
|`disabled`|`boolean`| No | Disable the input |
209
+
|`showFlags`|`boolean`| No | Show country flag next to dial code (default: `true`) |
210
+
|`size`|`"sm" \| "default" \| "lg"`| No | Field height (default: `"default"`) |
211
+
|`align`|`"start" \| "end"`| No | Edge of the field the menu lines up with (default: `"start"`) |
212
+
|`side`|`"top" \| "bottom"`| No | Preferred menu side; flips when there is no room (default: `"bottom"`) |
213
+
|`searchPlaceholder`|`string`| No | Placeholder for the country search (default: `"Search countries..."`) |
214
+
|`emptyMessage`|`ReactNode`| No | Shown when the search matches nothing (default: `"No countries found."`) |
215
+
|`labels`|`Partial<PhoneInputLabels>`| No | Override the built-in English UI text (see below) |
216
+
|`displayLocale`|`string`| No | Locale for country names, e.g. `"fr"` (default: English names) |
217
+
|`maxHeight`|`number \| string`| No | Max height of the scrolling country list (default: `"15rem"`) |
218
+
|`label`|`string`| No | Accessible label for the input |
219
+
|`className`|`string`| No | Classes for the root wrapper |
0 commit comments