Note Web support is Experimental and may be changed at any time. Use it only for evaluation purposes. We would appreciate your feedback on it in the public Slack channel #compose-web. If you face any issues, please report them on GitHub.
You can experiment with sharing your mobile or desktop UIs with the web. Compose for Web is based on Kotlin/Wasm, the newest target for Kotlin Multiplatform projects. It allows Kotlin developers to run their code in the browser with all the benefits that WebAssembly has to offer, such as good and predictable performance for your applications.
Web version of an image gallery for remote server image viewing built with Compose Multiplatform.
Check out the repo, navigate to the project folder, and use the following commands:
./gradlew :webApp:wasmRun
./gradlew :desktopApp:run
./gradlew :androidApp:installDebug
Note Using experimental Kotlin/Wasm may require enabling experimental features in the target environment.
- Chrome 110 or newer: enable WebAssembly Garbage Collection at chrome://flags/#enable-webassembly-garbage-collection or with Chrome 109 or newer, run the program with the
--js-flags=--experimental-wasm-gc
command line argument. - Firefox Nightly 112 or newer: enable javascript.options.wasm_function_references and javascript.options.wasm_gc at about:config.
- Edge 109 or newer: run the program with the
--js-flags=--experimental-wasm-gc
command line argument.
For more information see https://kotl.in/wasm_help/.
We recommend using IntelliJ IDEA 2023.1 or newer to work with the project.
Give it a try, and share your feedback and ask questions in the Kotlin Slack #compose-web channel (if you’re not a member, apply here) or on Twitter to @bashorov.