Put PhoneFieldGroup inside PhoneField, and name on PhoneFieldInput to submit E.164. onValueChange gets E.164 first, or null while the number is not possible.
contact-phone.tsx
PhoneField
<fieldset>| Prop | Type | Default | Description |
|---|---|---|---|
| disabled | boolean | false | |
| value | string | — | The number as shown (controlled). |
| default | string | "" | |
| on | — | Runs on every change with E.164 (or null while not possible) and every detail. | |
| country | null"AC""AD""AE""AF""AG""AI""AL""AM""AO""AR""AS""AT""AU""AW""AX""AZ""BA""BB""BD""BE""BF""BG""BH""BI""BJ""BL""BM""BN""BO""BQ""BR""BS""BT""BW""BY""BZ""CA""CC""CD""CF""CG""CH""CI""CK""CL""CM""CN""CO""CR""CU""CV""CW""CX""CY""CZ""DE""DJ""DK""DM""DO""DZ""EC""EE""EG""EH""ER""ES""ET""FI""FJ""FK""FM""FO""FR""GA""GB""GD""GE""GF""GG""GH""GI""GL""GM""GN""GP""GQ""GR""GT""GU""GW""GY""HK""HN""HR""HT""HU""ID""IE""IL""IM""IN""IO""IQ""IR""IS""IT""JE""JM""JO""JP""KE""KG""KH""KI""KM""KN""KP""KR""KW""KY""KZ""LA""LB""LC""LI""LK""LR""LS""LT""LU""LV""LY""MA""MC""MD""ME""MF""MG""MH""MK""ML""MM""MN""MO""MP""MQ""MR""MS""MT""MU""MV""MW""MX""MY""MZ""NA""NC""NE""NF""NG""NI""NL""NO""NP""NR""NU""NZ""OM""PA""PE""PF""PG""PH""PK""PL""PM""PR""PS""PT""PW""PY""QA""RE""RO""RS""RU""RW""SA""SB""SC""SD""SE""SG""SH""SI""SJ""SK""SL""SM""SN""SO""SR""SS""ST""SV""SX""SY""SZ""TA""TC""TD""TG""TH""TJ""TK""TL""TM""TN""TO""TR""TT""TV""TW""TZ""UA""UG""US""UY""UZ""VA""VC""VE""VG""VI""VN""VU""WF""WS""XK""YE""YT""ZA""ZM""ZW" | — | The country (controlled). In international format the typed + code also sets it. |
| default | "AC""AD""AE""AF""AG""AI""AL""AM""AO""AR""AS""AT""AU""AW""AX""AZ""BA""BB""BD""BE""BF""BG""BH""BI""BJ""BL""BM""BN""BO""BQ""BR""BS""BT""BW""BY""BZ""CA""CC""CD""CF""CG""CH""CI""CK""CL""CM""CN""CO""CR""CU""CV""CW""CX""CY""CZ""DE""DJ""DK""DM""DO""DZ""EC""EE""EG""EH""ER""ES""ET""FI""FJ""FK""FM""FO""FR""GA""GB""GD""GE""GF""GG""GH""GI""GL""GM""GN""GP""GQ""GR""GT""GU""GW""GY""HK""HN""HR""HT""HU""ID""IE""IL""IM""IN""IO""IQ""IR""IS""IT""JE""JM""JO""JP""KE""KG""KH""KI""KM""KN""KP""KR""KW""KY""KZ""LA""LB""LC""LI""LK""LR""LS""LT""LU""LV""LY""MA""MC""MD""ME""MF""MG""MH""MK""ML""MM""MN""MO""MP""MQ""MR""MS""MT""MU""MV""MW""MX""MY""MZ""NA""NC""NE""NF""NG""NI""NL""NO""NP""NR""NU""NZ""OM""PA""PE""PF""PG""PH""PK""PL""PM""PR""PS""PT""PW""PY""QA""RE""RO""RS""RU""RW""SA""SB""SC""SD""SE""SG""SH""SI""SJ""SK""SL""SM""SN""SO""SR""SS""ST""SV""SX""SY""SZ""TA""TC""TD""TG""TH""TJ""TK""TL""TM""TN""TO""TR""TT""TV""TW""TZ""UA""UG""US""UY""UZ""VA""VC""VE""VG""VI""VN""VU""WF""WS""XK""YE""YT""ZA""ZM""ZW" | — | |
| on | — | ||
| phone | "international""national" | "international" | international (default): "+49 30 901820". national: "030 901820", the dial code in the trigger. |
| countries | readonly CountryCode[] | — | Limit the list (in this order). One country: no list, no chevron. |
| metadata | MetadataJson | PHONE_METADATA | libphonenumber-js metadata: min by default; max for exact valid and type. |
| check | "possible""valid" | "possible" | possible (default): the length fits. valid: the country ranges (use with max). |
| locale | string | — | The language of the country names (Intl.DisplayNames). Default en, the same on server and client. |
| render | — | Your own flags (static imports for the server HTML, another set, or none: return null). | |
| labels | — | The texts (translate them). {country} is the country name. | |
| read | boolean | false | |
| show | boolean | false | Show the error now, as after a submit. |
| required | boolean | false | An empty number is an error (labels.required) after a blur or with showErrors. |
| ...props | <fieldset> attributes | — | Every other attribute goes to the <fieldset>, with a ref. |
PhoneFieldLabel
<label>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <label> attributes | — | Every other attribute goes to the <label>, with a ref. |
PhoneFieldGroup
<div>PhoneFieldFlag
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| locale | string | — | The language of the name (Intl.DisplayNames). Default: the DisplayLocaleProvider locale. |
| pop | boolean | — | Pop the art in when code changes: scale 0.9 to 1 and a fade on the popup clock. |
| variant | "circle""rectangle""square" | — | |
| country | null"AC""AD""AE""AF""AG""AI""AL""AM""AO""AR""AS""AT""AU""AW""AX""AZ""BA""BB""BD""BE""BF""BG""BH""BI""BJ""BL""BM""BN""BO""BQ""BR""BS""BT""BW""BY""BZ""CA""CC""CD""CF""CG""CH""CI""CK""CL""CM""CN""CO""CR""CU""CV""CW""CX""CY""CZ""DE""DJ""DK""DM""DO""DZ""EC""EE""EG""EH""ER""ES""ET""FI""FJ""FK""FM""FO""FR""GA""GB""GD""GE""GF""GG""GH""GI""GL""GM""GN""GP""GQ""GR""GT""GU""GW""GY""HK""HN""HR""HT""HU""ID""IE""IL""IM""IN""IO""IQ""IR""IS""IT""JE""JM""JO""JP""KE""KG""KH""KI""KM""KN""KP""KR""KW""KY""KZ""LA""LB""LC""LI""LK""LR""LS""LT""LU""LV""LY""MA""MC""MD""ME""MF""MG""MH""MK""ML""MM""MN""MO""MP""MQ""MR""MS""MT""MU""MV""MW""MX""MY""MZ""NA""NC""NE""NF""NG""NI""NL""NO""NP""NR""NU""NZ""OM""PA""PE""PF""PG""PH""PK""PL""PM""PR""PS""PT""PW""PY""QA""RE""RO""RS""RU""RW""SA""SB""SC""SD""SE""SG""SH""SI""SJ""SK""SL""SM""SN""SO""SR""SS""ST""SV""SX""SY""SZ""TA""TC""TD""TG""TH""TJ""TK""TL""TM""TN""TO""TR""TT""TV""TW""TZ""UA""UG""US""UY""UZ""VA""VC""VE""VG""VI""VN""VU""WF""WS""XK""YE""YT""ZA""ZM""ZW" | — | The country, or null for the globe. Default: the country of the field. |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
PhoneFieldCountry
<div>PhoneFieldInput
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| name | string | — | Submit E.164 under this name (a hidden input). |
| class | string | — | |
| guide | boolean | — | The ghost guide of the slots still to fill, while the input has focus. Default true. |
| raw | string | — | Also submit the raw value under this name (a hidden input), next to the shown one. |
| reject | boolean | — | Nudge the field 2px when the mask rejects a key. Default true. |
| on | — | Runs when the mask rejects a key (a letter in a number, a 13th month). | |
| ref | Ref<HTMLInputElement> | — | |
| rounded | "default""full" | — | |
| size | "default""lg""sm""xs" | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>. |
PhoneFieldError
<p>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <p> attributes | — | Every other attribute goes to the <p>, with a ref. |
| EnterorSpaceorArrow Down | On PhoneFieldCountry: opens the country list. |
|---|---|
| Arrow keys | In the list: moves through the countries. |
| Enter | In the list: picks the country. |
| Escape | Closes the country list. |
Built with
Installs with Phone Field
- Components
- Combobox,Country Flag,Input Group,Masked Input





