CountryConfig

class CountryConfig(val onlyShowCountryCodes: Set<String> = emptySet(), val locale: Locale = Locale.getDefault(), val tinyMode: Boolean = false, val disableDropdownWithSingleElement: Boolean = false, collapsedLabelMapper: (Country) -> String = { country -> country.name }, expandedLabelMapper: (Country) -> String = { country -> "${countryCodeToEmoji(country.code.value)} ${country.name}" }) : DropdownConfig

This is the configuration for a country dropdown.

Parameters

expandedLabelMapper

: function called to get the expanded label for the given country.

Constructors

Link copied to clipboard
constructor(onlyShowCountryCodes: Set<String> = emptySet(), locale: Locale = Locale.getDefault(), tinyMode: Boolean = false, disableDropdownWithSingleElement: Boolean = false, collapsedLabelMapper: (Country) -> String = { country -> country.name }, expandedLabelMapper: (Country) -> String = { country -> "${countryCodeToEmoji(country.code.value)} ${country.name}" })

Types

Link copied to clipboard

Properties

Link copied to clipboard
open override val debugLabel: String

This is a label for debug logs

Link copied to clipboard
open override val disableDropdownWithSingleElement: Boolean = false

Whether the dropdown should be disabled when there is only one single item

Link copied to clipboard
open override val displayItems: List<String>

This is the list of displayable items to show in the drop down

Link copied to clipboard
open override val label: Int

This is the label to describe the field

Link copied to clipboard

: the locale used to display the country names.

Link copied to clipboard

: a list of country codes that should be shown. If empty, all countries will be shown.

Link copied to clipboard
open override val rawItems: List<String>

The list of raw values to use in the parameter map

Link copied to clipboard
open override val tinyMode: Boolean = false

: whether to display in "tiny mode" when collapsed, a smaller UI form used when the dropdown menu is inside another component, like PhoneNumberElement.

Functions

Link copied to clipboard
open override fun convertFromRaw(rawValue: String): String

This will convert from a raw value used in the parameter map to a display value

Link copied to clipboard
open override fun getSelectedItemLabel(index: Int): String

The label identifying the selected item used when the dropdown menu is collapsed