
Embeds host WebView into declarative UI, exposing a compact common API for loading pages, observing URL/loading state, driving navigation — uses native WebView instead of bundling Chromium.
Language: English | 简体中文
wvbridge is a Compose Multiplatform library that embeds the host platform WebView and
exposes a small, Kotlin-friendly common API for loading pages, observing URL and loading state
changes, and driving basic browser navigation.
Documentation site: wvbridge.kagg886.top
Note: This project is under active development. APIs and platform coverage may change.
Add the common API to your shared source set:
repositories {
mavenCentral()
}
kotlin {
sourceSets {
commonMain.dependencies {
implementation("top.kagg886.wvbridge:core:<version>")
}
}
}On JVM, wvbridge also needs a platform-specific native runtime library. The recommended approach is
to use Google's os-detector Gradle plugin and choose the runtime artifact from
osdetector.classifier.
plugins {
id("com.google.osdetector") version "1.7.3"
}
repositories {
mavenCentral()
}
kotlin {
jvm()
sourceSets {
jvmMain.dependencies {
val platform = when (osdetector.classifier) {
"windows-x86_64" -> "platform-windows"
"linux-x86_64" -> "platform-linux"
"osx-aarch_64" -> "platform-macos"
else -> error(
"Unsupported JVM runtime for wvbridge: ${osdetector.classifier}. " +
"Supported classifiers are windows-x86_64, linux-x86_64, and osx-aarch_64."
)
}
runtimeOnly("top.kagg886.wvbridge:$platform:<version>")
}
}
}Current JVM native runtime support is limited to:
windows-x86_64
linux-x86_64
osx-aarch_64
Create a remembered state and render WebView:
import androidx.compose.ui.Modifier
import top.kagg886.wvbridge.WebView
import top.kagg886.wvbridge.rememberWebViewState
val webViewState = rememberWebViewState("https://example.com")
WebView(
state = webViewState,
modifier = Modifier,
)Basic navigation uses WebViewState.navigator:
webViewState.navigator.loadUrl("https://kotlinlang.org")
webViewState.navigator.goBack()
webViewState.navigator.goForward("")
webViewState.navigator.refresh()
webViewState.navigator.stop()More features are documented at wvbridge.kagg886.top.
WebViewState.url is suitable for address-bar synchronization and may contain custom URL schemes
if the underlying native engine supports them../gradlew :sample:compose:desktopApp:run
sample/compose/androidApp
sample/compose/iosApp/iosApp.xcodeproj in Xcode and run the sample appcore: common interfaces, states, and Compose APIplatform/*: JVM native runtime backends for each desktop platformsample/*: sample applicationsLanguage: English | 简体中文
wvbridge is a Compose Multiplatform library that embeds the host platform WebView and
exposes a small, Kotlin-friendly common API for loading pages, observing URL and loading state
changes, and driving basic browser navigation.
Documentation site: wvbridge.kagg886.top
Note: This project is under active development. APIs and platform coverage may change.
Add the common API to your shared source set:
repositories {
mavenCentral()
}
kotlin {
sourceSets {
commonMain.dependencies {
implementation("top.kagg886.wvbridge:core:<version>")
}
}
}On JVM, wvbridge also needs a platform-specific native runtime library. The recommended approach is
to use Google's os-detector Gradle plugin and choose the runtime artifact from
osdetector.classifier.
plugins {
id("com.google.osdetector") version "1.7.3"
}
repositories {
mavenCentral()
}
kotlin {
jvm()
sourceSets {
jvmMain.dependencies {
val platform = when (osdetector.classifier) {
"windows-x86_64" -> "platform-windows"
"linux-x86_64" -> "platform-linux"
"osx-aarch_64" -> "platform-macos"
else -> error(
"Unsupported JVM runtime for wvbridge: ${osdetector.classifier}. " +
"Supported classifiers are windows-x86_64, linux-x86_64, and osx-aarch_64."
)
}
runtimeOnly("top.kagg886.wvbridge:$platform:<version>")
}
}
}Current JVM native runtime support is limited to:
windows-x86_64
linux-x86_64
osx-aarch_64
Create a remembered state and render WebView:
import androidx.compose.ui.Modifier
import top.kagg886.wvbridge.WebView
import top.kagg886.wvbridge.rememberWebViewState
val webViewState = rememberWebViewState("https://example.com")
WebView(
state = webViewState,
modifier = Modifier,
)Basic navigation uses WebViewState.navigator:
webViewState.navigator.loadUrl("https://kotlinlang.org")
webViewState.navigator.goBack()
webViewState.navigator.goForward("")
webViewState.navigator.refresh()
webViewState.navigator.stop()More features are documented at wvbridge.kagg886.top.
WebViewState.url is suitable for address-bar synchronization and may contain custom URL schemes
if the underlying native engine supports them../gradlew :sample:compose:desktopApp:run
sample/compose/androidApp
sample/compose/iosApp/iosApp.xcodeproj in Xcode and run the sample appcore: common interfaces, states, and Compose APIplatform/*: JVM native runtime backends for each desktop platformsample/*: sample applications