Country Select

This component can be found under the Sybrin.Identity namespace and is called CountrySelectComponent.

Full name: Sybrin.Identity.CountrySelectComponent.

It is a component that provides basic country selection functionality in the form of a simple UI. The Web SDK requires a country code for data extraction and it's recommended that you use this component to obtain said country code.

With default styling, the country select component appears as follows:

The "Next" button will remain disabled until a country has been selected. Selection is confirmed upon clicking the "Next" button and then the onCountrySelected event will fire.


The country select component can be initialized using the following code:

<div id='country-select'></div>

The Sybrin Web SDK provides the option to either pass down the ID of the element you wish to use for component initialization, or to pass the element directly.

Please note that 'country-select' is just an example in this context and the ID may be changed as desired as long as it matches the value passed down during component initialization in JavaScript.

During initialization, the country select component allows for a number of configuration options that may be passed down using an object literal. The parameters that may be used on the object include the following:


  • id (string): ID of the element you wish to use for component initialization. Not required if element is passed.

  • element (HTMLElement): Element you wish to use for component initialization. Not required if id is passed.


  • defaultCountry (string): The country code of the country that must be selected by default.

  • documentTypeName (string): The document type name to filter country selection by. If a document type name is passed down, only countries that support the specified document type will be shown. Please see document type overrides & filtering for a list of accepted values.

  • countries (Sybrin.Identity.Country[]): Explicit country filter. Please see country overrides & filtering for details.

  • translations ({ [key: string]: string }): An object literal representing a dictionary lookup that will be used for translating the component. Please see the translations section on this page for a list of all translatable text, as well as the localization page for a detailed description on how to implement localization.

Warning: Initialization will fail if the intended host element does not exist yet.

Always ensure that the initialize function is only called after the DOM is loaded.

Country Overrides & Filtering

When creating an instance of the country select component, the SDK allows for a documentTypeNamestring parameter, which will be used to filter countries based on the document type. Additionally, the SDK allows for a countries parameter which can be used for more specific override options. The countries parameter is a collection of Sybrin.Identity.Country where each instance has the properties code, name and enabled.

  • code (string): The unique identifier (Alpha-3 standard country code) used to target a country to override.

  • name (string): Can be used to override the display name of the targeted country.

  • enabled (boolean): Can be used to filter out the targeted country (if set to false)

Supported country codes are:

  • Ghana: 'GHA'

  • Kenya: 'KEN'

  • Malawi: 'MWI'

  • Mozambique: 'MOZ'

  • South Africa: 'ZAF'

  • Uganda: 'UGA'

  • Zimbabwe: 'ZWE'

  • Other: 'GEN'

Advanced filtering and override example:

var component = new Sybrin.Identity.CountrySelectComponent({
    id: 'viewport',
    documentTypeName: 'idcard',
    countries: [
        new Sybrin.Identity.Country({ code: 'ZAF', name: 'Southern Africa' }),
        new Sybrin.Identity.Country({ code: 'UGA', enabled: false })

By specifying documentTypeName as 'idcard', it will only show countries that support the ID Card document type. The first country instance in the countries collection overrides 'ZAF', which is South Africa, to display as Southern Africa instead. The second instance filters 'UGA', which is Uganda, out so that it doesn't appear as part of the list even though the Ugandan ID Card document type is supported.


The country select component may be removed from the UI by calling the destroy() function on it.





initialize(): void

Initializes the component's DOM and events.


destroy(): void

Destroys the component's DOM and events.

Set Translations

setTranslations(translations?: { [key: string]: string; }): void

Changes the component's translations to the provided values and updates the DOM accordingly.


The country select component offers one event for reacting to country selection. To hook onto the event, simply assign a function to it.

The following option is available:

  • onCountrySelected(alpha3Code: string, alpha2Code: string, numericCode: string)

On Country Selected

This function is called when a country is selected. To hook onto the event, you may use the following code:

component.onCountrySelected = function(alpha3Code, alpha2Code, numericCode) {
    console.log('The selected country Alpha-3 code is: ', alpha3Code);
    console.log('The selected country Alpha-2 code is: ', alpha2Code);
    console.log('The selected country numeric code is: ', numericCode);

The alpha3Code, alpha2Code and numericCode parameters are all of type string.


The country select component is structured a follows:

<div class="sybrin-identity-container sybrin-sdk-container">
    <div class="sybrin-identity-component-section sybrin-sdk-component-section">
        <div class="sybrin-identity-list sybrin-sdk-list sybrin-custom-scrollbar">
            <div class="sybrin-identity-card sybrin-sdk-card sybrin-country-KEN">
                <div class="sybrin-identity-card-image">
                    <img src="data:image/png;charset=utf-8;base64,">
                <div class="sybrin-identity-text sy-i-translation-20">
    <div class="sybrin-identity-button-section sybrin-sdk-button-section">
        <button disabled="disabled" class="sybrin-identity-next sybrin-identity-flow-button sybrin-sdk-flow-button sy-i-translation-28">Next</button>

The classes and elements specified above may be used to freely style the country select component as desired. To do so, simply create a stylesheet and include it in the project, then style according to the above classes and elements.

The element with the sybrin-identity-card class repeats for every country option. The above example only uses Kenya as an example, however the same element would repeat for each country option in the list, using the relevant country code for the CSS class and the relevant country name in the display text.

Styling implementation example:

    <link rel="stylesheet" type="text/css" href="styles.css" media="screen"/>
    <div id='component'></div>


This component is affected by the following translation keys:

Translation KeyDescriptionDefault/Source


Display name for Ghana



Display name for Kenya



Display name for Malawi



Display for Mozambique



Display name for Philippines



Display name for South Africa

South Africa


Display name for Uganda



Display name for Zimbabwe



Display name for other

Any other country


Caption of the button that proceeds to the next step


Last updated