TogiCountryCodePicker

fun TogiCountryCodePicker(onValueChange: (Pair<PhoneCode, String>, Boolean) -> Unit, modifier: Modifier = Modifier, autoDetectCode: Boolean = false, enabled: Boolean = true, shape: Shape = DEFAULT_TEXT_FIELD_SHAPE, showCountryCode: Boolean = true, showCountryFlag: Boolean = true, colors: TextFieldColors = TextFieldDefaults.outlinedTextFieldColors(), fallbackCountry: CountryData = CountryData.UnitedStates, showPlaceholder: Boolean = true, includeOnly: ImmutableSet<String>? = null, clearIcon: ImageVector? = Icons.Filled.Clear, initialPhoneNumber: String? = null, initialCountryIsoCode: Iso31661alpha2? = null, initialCountryPhoneCode: PhoneCode? = null, label: @Composable () -> Unit? = null, textStyle: TextStyle = MaterialTheme.typography.body1.copy( color = colors.textColor(enabled = true).value, ), keyboardOptions: KeyboardOptions? = null, keyboardActions: KeyboardActions? = null, showError: Boolean = true)

Parameters

onValueChange

Called when the text in the text field changes. The first parameter is string pair of (country phone code, phone number) and the second parameter is a boolean indicating whether the phone number is valid.

modifier

Modifier to be applied to the inner OutlinedTextField.

autoDetectCode

Boolean indicating if will auto detect the code from initial phone number

enabled

Boolean indicating whether the field is enabled.

shape

Shape of the text field.

showCountryCode

Whether to show the country code in the text field.

showCountryFlag

Whether to show the country flag in the text field.

colors

TextFieldColors to be used for the text field.

fallbackCountry

The country to be used as a fallback if the user's country cannot be determined. Defaults to the United States.

showPlaceholder

Whether to show the placeholder number hint in the text field.

includeOnly

A set of 2 digit country codes to be included in the list of countries. Set to null to include all supported countries.

clearIcon

ImageVector to be used for the clear button. Set to null to disable the clear button. Defaults to Icons.Filled.Clear

initialPhoneNumber

an optional phone number to be initial value of the input field

initialCountryIsoCode

Optional ISO-3166-1 alpha-2 country code to set the initially selected country. Note that if a valid initialCountryPhoneCode is provided, this will be ignored.

initialCountryPhoneCode

Optional country phone code to set the initially selected country. This takes precedence over initialCountryIsoCode.

label

An optional composable to be used as a label for input field

textStyle

An optional TextStyle for customizing text style of phone number input field. Defaults to MaterialTheme.typography.body1

keyboardOptions

An optional KeyboardOptions to customize keyboard options.

keyboardActions

An optional KeyboardActions to customize keyboard actions.

showError

Whether to show error on field when number is invalid, default true.