CountryPicker

fun CountryPicker(onClick: (Country) -> Unit, selectedCountry: Country?, modifier: Modifier = Modifier, countries: List<Country> = Country.all, locale: String? = null, searchField: @Composable (query: String, onQueryChange: (String) -> Unit) -> Unit? = { query, onQueryChange -> CountryPickerDefaults.SearchField(query, onQueryChange) }, searchFilter: (query: String, countries: List<Country>) -> List<Country> = { query, countries -> countries.filterByQuery(query, locale, FilterField.country) }, emptyContent: @Composable () -> Unit = { CountryPickerDefaults.EmptyContent() }, itemContent: @Composable (country: Country, selected: Boolean, onClick: () -> Unit) -> Unit = { country, selected, onClick -> CountryPickerDefaults.CountryItem( country = country, selected = selected, onClick = onClick, locale = locale, ) })

Searchable country picker with selectable rows.

This should be placed inside a container such as a dialog or bottom sheet. It provides customizable search and item content for different use cases, such as country, calling-code, or currency picking.

Parameters

onClick

Callback invoked when a country row is clicked

selectedCountry

Currently selected country, or null if none

modifier

Modifier applied to the root column

countries

List of country to display

locale

BCP 47 language tag for localized content, or null for system default

searchField

Search field content, or null to hide it

searchFilter

Filters countries for the current query

emptyContent

Empty state content when no countries match the current query

itemContent

Content for each country row

See also