Welcome to ComposeWebView¶
ComposeWebView is a powerful, flexible, and feature-rich WebView wrapper designed specifically for Jetpack Compose and Compose Multiplatform.
It provides a unified API to control WebViews across Android, iOS, Desktop, and Web, with a strong focus on mobile productivity and developer experience.
✨ Key Features¶
-
Multiplatform Support ---
Run your WebView logic on Android, iOS, Desktop (CEF), and Web (JS) with a single codebase.
-
Advanced JSBridge ---
Promise-based, type-safe communication between Kotlin and JavaScript. No more callback hell.
-
Reactive State ---
Monitor URL changes, loading progress, and errors using standard Compose state objects.
-
Rich Capabilities ---
Built-in support for File Uploads, Fullscreen Video, and Custom Views.
📱 Platform Support¶
| Platform | Implementation | Status | Note |
|---|---|---|---|
| Android | AndroidView (WebView) |
Full feature support | |
| iOS | UIKitView (WKWebView) |
Full feature support (Seamless JS Bridge) | |
| Desktop | SwingPanel (CEF via JCEF) |
WIP: Basic browsing works. JCEF integration in progress. | |
| Web (JS) | Iframe (DOM overlay) |
WIP: Uses DOM overlay to stay compatible with Compose UI (Canvas). CORS/browser policy limitations apply. | |
| Web (WASM) | Iframe (DOM) |
WIP: Uses iframe with dynamic positioning. Same-origin policy restrictions. |
Web(JS) Runtime Model
Web(JS) uses imperative DOM overlay instead of Compose HTML DOM nodes to avoid runtime Applier conflicts in Compose UI(Canvas) apps.
Desktop (macOS) Troubleshooting¶
If JCEF fails with IllegalAccessError mentioning sun.awt, sun.lwawt, or sun.lwawt.macosx, add JVM module options to your Compose Desktop app:
compose.desktop {
application {
jvmArgs += listOf(
"--add-exports=java.desktop/sun.awt=ALL-UNNAMED",
"--add-opens=java.desktop/sun.awt=ALL-UNNAMED",
"--add-exports=java.desktop/sun.lwawt=ALL-UNNAMED",
"--add-opens=java.desktop/sun.lwawt=ALL-UNNAMED",
"--add-exports=java.desktop/sun.lwawt.macosx=ALL-UNNAMED",
"--add-opens=java.desktop/sun.lwawt.macosx=ALL-UNNAMED",
)
}
}
Project Focus: Mobile Productivity
This library is optimized for Mobile (Android & iOS) development. While Desktop and Web are supported, they are currently experimental. If you need a battle-tested solution primarily for Desktop/Web, other libraries might be a better fit.
🚀 Get Started¶
Ready to start building? Check out the Getting Started guide to add compose-webview to your project in minutes.