compose-web-navigator
1.1.0indexedFacilitates web navigation for user interfaces, simplifying route management and enhancing web application interaction through streamlined dependency integration.
Facilitates web navigation for user interfaces, simplifying route management and enhancing web application interaction through streamlined dependency integration.
Compose Web Navigator is a library that provides navigation capabilities for Compose Multiplatform Wasm applications. It allows developers to easily manage navigation between different screens and handle browser history.
To use the Compose Web Navigator in your project, add the following to your build.gradle.kts file:
plugins {
id("io.github.taz03.compose-web-navigator") version "<version>"
}
kotlin {
wasmJs {
browser()
binaries.executable()
}
sourceSets.commonMain.dependencies {
implementation("io.github.taz03:compose-web-navigator:<version>")
}
}
val navController = rememberSaveable { NavController() }
NavHost(navController = navController) {
route("/") {
Text("Home")
}
route("/about") {
Text("About")
}
route("/user/{id}") { route ->
Text("User ID: ${route.pathParameters["id"]}")
Text("Query: ${route.queryParameters["query"]}")
}
}
Supported path patterns:
/home, /about/user/{id}/files/*pathTo run the application in a development server, use:
gradle runWebServer
For production deployment, build the release binaries with:
gradle buildWebReleaseBinaries
And server with your preferred static file server. Configure the server to serve index.html for all routes to support client-side routing.
Surfaced from shared tags and platforms — no rankings paid for.