Skip to content

Latest commit

ย 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Kountry

GitHub Packages:

Release Prerelease

Maven Central:

core core-ui

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:

Android iOS JVM JavaScript WebAssembly

Installation

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")
        }
    }
}

Usage

core

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$"

core-ui

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 },
    )
}

Web

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.

Data Sources

The country dataset is based on the following sources, as of 2026/08/13:

License

MIT

About

๐ŸŒ Lightweight Kotlin Multiplatform country metadata library

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages