navigation is a lightweight and concise Compose Multiplatform library wrapper around Jetpack Navigation 3, designed to provide ultra-clean boilerplate-free routing with built-in gestures and fluid transitions like circular reveal.
- Concise DSL navigation wrapper over Navigation 3 (
Navigator(HomeKey) { ... }). - Automatic
LocalNavigatorprovider for child composables (push,pop,replace). - Native Predictive Back support for Android (swipe gesture tracking with real-time finger progress).
- Circular Reveal & Unreveal transitions with dynamic touch origin coordinates (
circularEntry). - Support for Composable dynamic border colors (e.g.
MaterialTheme.colorScheme.primary). - Zero-configuration state persistence without manual polymorphic serialization boilerplate.
| Platform | Support |
|---|---|
| Android | ✅ |
| Desktop (JVM) | ✅ |
| iOSX64/iOSArm64/iosSimulatorArm64 | ✅ |
| WasmJs | ✅ |
- Paste this code into your
libs.versions.tomlfile:
[versions]
navigation = "0.1.0"
[libraries]
navigation = { module = "com.feraxhp.navigation:navigation", version.ref = "navigation" }- Then add the dependency into your
build.gradle.ktsinkotlin > sourceSets > commonMain.dependencies:
implementation(libs.navigation)-
Sync Project with Gradle.
-
Define your keys (screens):
sealed class Screens : NavKey {
@Serializable
data object Home : Screens()
@Serializable
data class Details(
val originX: Float,
val originY: Float
) : Screens(), CircularRevealKey {
override val origin: Offset
get() = Offset(originX, originY)
}
}- Call
Navigatoranywhere in your application:
import com.feraxhp.navigation.Navigator
@Composable
fun App() {
Navigator(start = Screens.Home) {
homeEntry()
detailsEntry()
}
}Navigator automatically injects LocalNavigator into the composition hierarchy. Any child composable can access it:
val navigator = LocalNavigator.current
// Push screen to the stack
navigator.push(Screens.Details(originX = 200f, originY = 500f))
// Pop screen (only pops if stack size > 1)
navigator.pop()
// Replace top screen
navigator.replace(Screens.Home)You can register any screen with an expanding circular reveal from the exact user tap position and smooth unreveal upon return:
fun EntryProviderScope<NavKey>.detailsEntry() {
circularEntry<Screens.Details>(
borderColor = { MaterialTheme.colorScheme.primary }, // Optional border ring
borderWidth = 2.dp
) { key ->
DetailsScreen()
}
}Tip
If your NavKey implements CircularRevealKey, circularEntry extracts origin automatically. You can also pass an explicit lambda origin = { key -> Offset(key.x, key.y) } without implementing the interface.
To see a sample of the implementation you can check :sample:sharedUI under commonMain.