Type Alias: CountryCodeOption
CountryCodeOption =
object
Defined in: packages/forms/src/phoneCountryCodes.ts:28
A curated list of the most common country calling codes paired with their
typical local phone number format patterns (using # as digit placeholders).
Import this constant and pass it to the countryCodeOptions prop of
FormFieldPhone to give users a ready-made country-code picker that also
automatically updates the number format when they switch countries.
Example
import { FormFieldPhone } from '@ttoss/forms';
// COMMON_PHONE_COUNTRY_CODES is the default — no need to pass it explicitly.
// Index 0 is the "Manual" entry; index 1 is US (+1).
const [countryCode, setCountryCode] = React.useState(
COMMON_PHONE_COUNTRY_CODES[1].value // '+1'
);
<FormFieldPhone
name="phone"
label="Phone"
countryCode={countryCode}
onCountryCodeChange={setCountryCode}
/>
Properties
format?
optionalformat:string| (value) =>string
Defined in: packages/forms/src/phoneCountryCodes.ts:38
Optional phone number format for the local part specific to this country
(e.g. '(###) ###-####'). When the user selects this option the format
is used automatically, overriding the format prop of FormFieldPhone.
label
label:
string
Defined in: packages/forms/src/phoneCountryCodes.ts:30
Label displayed in the dropdown (e.g. 'US +1').
value
value:
string
Defined in: packages/forms/src/phoneCountryCodes.ts:32
The calling-code value (e.g. '+1').