GitHub Packages:
Maven Central:
Important
The Maven Central artifacts are not ready for use. Breaking changes are expected before v0.0.1. I can't publish another Maven Central version till next month because I'm out of publishing quota ;-;
Use the latest prelease if you want to try the project.
Lightweight Kotlin Multiplatform library for country metadata, with optional Compose Multiplatform UI components.
Kountry also provides localized country and currency names and symbols using each platform's native locale APIs. It's meant for quick MVPs and prototypes, with emoji flags instead of image assets, but feel free to use it beyond that if you want to :)
Supported Targets:
Add Maven Central if you haven't already:
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
mavenCentral()
// Optional: required for prerelease builds
maven {
name = "githubPackages"
url = uri("https://maven.pkg.github.com/monosz/kountry")
}
}
}Then add the dependency:
// module build.gradle.kts
kotlin {
sourceSets {
commonMain.dependencies {
val version = "0.0.1-rc.3" // Use the latest release or prerelease tag
// Core country metadata
implementation("io.github.monosz:kountry-core:$version")
// Optional: Compose Multiplatform components
implementation("io.github.monosz:kountry-core-ui:$version")
}
}
}import io.github.monosz.kountry.core.Country
val all = Country.all
val usa = Country.USA
// Or find a country by lookups like so:
// val usa = Country.byIso2("US")
usa.flag // "๐บ๐ธ"
usa.displayName() // "United States"
usa.displayName("id-ID") // "Amerika Serikat"
usa.callingCode // "+1"
usa.currencyCode // "USD"
usa.currencyName() // "US Dollar"
usa.currencySymbol() // "US$"import androidx.compose.runtime.*
import io.github.monosz.kountry.core.Country
import io.github.monosz.kountry.core.ui.CountrySelector
@Composable
fun MyScreen() {
var selectedCountry by remember { mutableStateOf<Country?>(null) }
CountrySelector(
selectedCountry = selectedCountry,
onCountrySelect = { selectedCountry = it },
)
}On JS/Wasm targets, wrap your content with PreloadEmojiFont so emoji flags can render properly:
import androidx.compose.ui.window.ComposeViewport
import io.github.monosz.kountry.core.ui.PreloadEmojiFont
fun main() {
ComposeViewport {
PreloadEmojiFont {
// your content
}
}
}For localized names in Chinese, Japanese, Arabic, or other non-Latin scripts, you may also need to preload a font that supports those characters.
The country dataset is based on the following sources, as of 2026/08/13:
- ISO 3166-1 for country codes
- ISO 4217 for currency codes
- ITU-T E.164 for calling codes