
Lightweight, concise navigation DSL offering boilerplate-free routing with automatic LocalNavigator injection, predictive back gestures, dynamic circular-reveal transitions, composable border colors, and zero-config state persistence.
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.
Navigator(HomeKey) { ... }).LocalNavigator provider for child composables (push, pop, replace).circularEntry).MaterialTheme.colorScheme.primary).| Platform | Support |
|---|---|
| Android | ✅ |
| Desktop (JVM) | ✅ |
| iOSX64/iOSArm64/iosSimulatorArm64 | ✅ |
| WasmJs | ✅ |
libs.versions.toml file:[versions]
navigation = "0.1.0"
[libraries]
navigation = { module = "com.feraxhp.navigation:navigation", version.ref = "navigation" }build.gradle.kts in kotlin > 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)
}
}Navigator anywhere 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
NavKeyimplementsCircularRevealKey,circularEntryextractsoriginautomatically. You can also pass an explicit lambdaorigin = { key -> Offset(key.x, key.y) }without implementing the interface.
To see a sample of the implementation you can check :sample:sharedUI under commonMain.
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.
Navigator(HomeKey) { ... }).LocalNavigator provider for child composables (push, pop, replace).circularEntry).MaterialTheme.colorScheme.primary).| Platform | Support |
|---|---|
| Android | ✅ |
| Desktop (JVM) | ✅ |
| iOSX64/iOSArm64/iosSimulatorArm64 | ✅ |
| WasmJs | ✅ |
libs.versions.toml file:[versions]
navigation = "0.1.0"
[libraries]
navigation = { module = "com.feraxhp.navigation:navigation", version.ref = "navigation" }build.gradle.kts in kotlin > 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)
}
}Navigator anywhere 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
NavKeyimplementsCircularRevealKey,circularEntryextractsoriginautomatically. You can also pass an explicit lambdaorigin = { key -> Offset(key.x, key.y) }without implementing the interface.
To see a sample of the implementation you can check :sample:sharedUI under commonMain.