CountrySearchField

fun CountrySearchField(query: String, onQueryChange: (String) -> Unit, modifier: Modifier = Modifier, placeholder: UiText = UiText.resource(Res.string.ccp_search_hint), onFocusChanged: (Boolean) -> Unit = {}, onSearchAction: () -> Unit = {}, onCancel: () -> Unit? = null, autoFocus: Boolean = false, style: CountryPickerStyle = CountryPickerTheme.style)(source)

The search field at the top of the picker.

At rest it is a quiet card; focused, its border turns to the accent and a soft ring blooms around it, so where the keyboard is typing is never in doubt. The clear button appears only once there is something to clear, and onCancel, when given, adds a Cancel action beside the field while it is focused — the familiar way to back out of a search on iOS, and a convenient one everywhere.

Filtering is the caller's job and is expected to be synchronous: there is no search button and no debounce, because local search over a few hundred countries is instant.

Parameters

onCancel

Clears the query and leaves the field. null hides the Cancel action.

autoFocus

Focus the field, and so raise the keyboard, as soon as it appears.