Demo-Page Repository

Home > mui-country-code-selector > CountryType

CountryType interface

This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Represents data for an individual country. Contains records for the name, the ITU-T E.164 international calling code, and two letter ISO 3166 country code of the country. Is used as the

Signature:

export interface CountryType

Properties

Property

Modifiers

Type

Description

code

string

(ALPHA) ITU-T E.164 assigned international calling code for the country. Although a country can have multiple calling codes, a single calling code is stored here. This is because the data structure is meant to be used as the options list for the country code selector, in which each calling code must have its own entry. See https://www.itu.int/pub/T-SP-E.164D or https://en.wikipedia.org/wiki/List_of_country_calling_codes for more information about the calling codes.

country

CountryName

(ALPHA) Name(s) of the country.

If there are more than one name, the list has the following structure: 1) the official or recommended short name (e.g, “Bolivia”), 2) a complementary addition to the name (e.g., “Plurinational State of”) or probably a better known version of the name (e.g., “Czech Republic” for “Czechia”), 3) …n) alternative spelling(s) of the name (e.g., “Cote d’Ivoire” and “Cote dIvoire” for “Côte d’Ivoire”).

The first entry can be used as the shortest possible representation of a country’s name. If there is more space the second entry could be added in parentheses to make it easier to identify the country. The alternate spellings can help in finding the country when searching.

displayIso?

string

(ALPHA) (Optional) The display version of the ISO 3166 code in the iso field.

Some entries are not real countries, but subdivisions of one (e.g., Ascension, SH-AC). Correct ISO 3166-2 subdivision code includes the two letter ISO 3166-1 code of the larger entity and a two letter code for the subdivision separated with a dash. Due to way Vite imports json files, it is easier to not include the dash in the iso field that is used as key in the json files containing the country name translations. In those cases the display version of the ISO 3166-2 code is stored in this field.

iso

IsoAlpha2

(ALPHA) Two letter ISO 3166 country code of the country. See https://www.iso.org/iso-3166-country-codes.html or https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes for more information about the ISO 3166 country codes. See also documentation for the displayIso field for more