# compose-web

Arkadii Ivanov

11/17/2023, 7:30 PM
As far as I understand, currently there are 3 variants of Compose for Web Browser. 1. Compose for HTML - uses
target, renders DOM elements (like React). 2. Compose for Web - uses
target, renders via canvas. 3. Compose for WASM - uses
target, renders via canvas. It would be really nice if Compose folks could mention all variants on various landing pages and READMEs. For instance, the main README says nothing about the variant #2. And the landing page mentions something called "Web" but redirects to the variant #3. WDYT?
plus1 8


11/17/2023, 8:28 PM
I suspect its because #2 is not likely to live for long once WASM support is farther along. With a canvas based approach in the browser, what reason would there be to choose #2 over #3?

Arkadii Ivanov

11/17/2023, 9:03 PM
I might be a bit unfamiliar with WASM, but are we able to use the usual JavaScript APIs available in the Browser? Like for example Web History API? Either way, it would be very useful to outline all options and maybe state their statuses.


11/17/2023, 11:39 PM
To your first question, my understanding is yes:
Agreed some clarity from JB would be welcome here

Arjan van Wieringen

11/18/2023, 8:49 AM
And will there be a WASM version of 1? This would make a lot of sense if you also have 3.

Arkadii Ivanov

11/18/2023, 9:00 AM
Well, leveraging the existing JavaScript ecosystem is crucial. If I understand it correctly, with the classic
target it's super easy and native. We can import and use any existing JS library, or freely use the APIs like
, etc. If with WASM we can do the same, then the only concern for me is its adoption by browsers.

Robert Jaros

11/20/2023, 6:58 PM
You can use existing JS libraries with K/Wasm, but it's a bit harder than with K/JS target (there is no
type in K/Wasm). You might be interested in a project I'm working on - It's similar to Compose HTML and supports both JS and WASM targets with the same application code. It's still an early phase and no artifacts are published, but it already has all the main features of Compose HTML.

Igor Demin

11/21/2023, 6:03 PM
We mentioned web targets in FAQ. I can add the following to that: • Compose for Web is a part of Compose Multiplatform, with a goal to share UI, using web canvas • JS and Wasm have different setups and ecosystems, but currently, we consider them as implementation details of Compose for Web. We are actively working on the Wasm target, but it’s still in its early stages. This is why we maintain the JS target in some samples to showcase Compose for Web. The current plan is to replace Compose for Web on Kotlin/JS by Compose for Web on Kotlin/Wasm as it reaches the same level of functionality and is available on Maven. It is not set in stone until Compose for Web reaches Beta - the further direction depends on user feedback and the Wasm target maturity. • Compose HTML is considered as a side library of Compose Multiplatform, to build DOM applications using Compose concepts. We plan to support it, though the current focus is on Compose for Web on Wasm. • There is an idea to support Compose HTML on Kotlin/Wasm, but it is just an idea for now, it is far from any plans
👍 2

Arkadii Ivanov

11/21/2023, 6:16 PM
Thanks for taking care of this! Yeah, more information would be nice to add.


11/22/2023, 11:19 AM
This is a super useful clarification!