Anyone using compose html in production?
# compose-web
u
Anyone using compose html in production?
👌 3
c
www.cmgapps.com 😉
u
is that website in compose html or are you saying all of those in portfolio?
c
The whole website is compose html
u
pure compose html or kobweb?
c
Pure.
u
oka thanks so you implemented navigation yourself? jetpack navigqtion?
c
I think Jetback navigation will not work with Compose HTML. We used https://github.com/hfhbd/routing-compose
thank you color 1
a
With #C04RTD72RQ8 too
r
Highly recommended if you are wiling to invest in a separate UI layer for the web, or web is the only target. compose-web is great, but has a big uncanny valley (i.e. it doesn't "feel" native). This is my favorite thread about the topic: https://kotlinlang.slack.com/archives/C01F2HV7868/p1728089469717169
u
yea im specifically trying to render html
r
I wouldn't hesitate to use compose-html then. If you are good with server-side rendering you could consider kotlinx-html (https://ktor.io/docs/server-html-dsl.html for a ktor integration), or for a hybrid approach you could consider htmx (ktor now also has an htmx integration, see https://ktor.io/docs/htmx-integration.html).
u
would you use compose html directly or via a higher level framework?
r
Depends what you are trying to do. If an enterprise app with many controls and tables and layouts, you might consider some kind of UI toolkit. I built mine on top of https://github.com/mpetuska/kmdc which wraps the (now deprecated) Google Material Web 2 components. This worked very well -- the end result was quite nice. Otherwise I might consider using it directly with something like Tailwind CSS for styling.
u
wont you miss routing etc?
r
Yes I assumed some kind of library for routing. We also used https://github.com/hfhbd/routing-compose mentioned above.
u
neat btw i didnt even know compose has a html backend and i follow kmp closely i wonder why jb only pushes the canvas wasm way
r
I think they are sold on the cross-platform UI idea. Makes it a lot easier to market if you can say CMP works on all platforms. Marketing compose-html in addition would confuse the message a bit.
u
yea but wasm will never be for say portfolio type of website, blog, eshop etc strange
h
We use bootstrap with my library (and of course my routing library): https://github.com/hfhbd/bootstrap-compose
m
I do use Compose HTML in production! https://loritta.website/ (parts of the bot management dashboard use Compose HTML, I do plan to rewrite everything on the dashboard to use Compose HTML) I also use Compose HTML for one of my Discord's activities for the game UI (the game canvas is rendered using WebGL2)
i wonder why jb only pushes the canvas wasm way
I think it is because Compose HTML is a wonderful library that sadly only has a very small niche JetBrains probably noticed that a lot of people kept coming here on this channel asking if they could use Compose Multiplatform components that they already used in Compose Desktop (like Row, Column, etc) in Compose HTML, so they decided to pivot their approach to port the entire renderer to Web instead, this way they could use the Desktop components on the Web too.
So Compose HTML is amazing if you... 1. Wanted a React alternative for Kotlin/JS 2. You don't want to use React on Kotlin/JS (in my experience the Compose HTML UX in Kotlin/JS is way better than React on Kotlin/JS) 3. You don't mind creating your own components from scratch 4. You don't mind using HTML/CSS 5. You love Kotlin kodee loving Sadly this niche is very tiny, so it makes sense from a business perspective that JetBrains prefer to focus their marketing to Compose for Web (WASM). Honestly if I was in charge, I would've renamed the Compose HTML to something else. The "Compose" branding has a lot of baggage that makes people confused. The marketing for it should be as a React (interactive components) alternative for Kotlin/JS, NOT as a Compose Multiplatform platform target. I do have my own Compose HTML fork use the kotlin-wrappers browser bindings instead of the default bindings) and when you look at the Compose HTML code, it isn't that complex because the Compose libraries/plugin do a lot of the work under the hood. In fact, Compose HTML as a library doesn't have a lot of meaningful updates if you look at the Compose Multiplatform repository, but that's because, in my opinion, it is already "feature complete" if your expectations is "I want to create interactive components in a React-like fashion".
And here's a screenshot of the Discord activity that I talked previously, the GUI is entirely in Compose HTML while the canvas is WebGL2 (the GUI is a bit scuffed because the game is still in beta, the game is a /r/place-like clone as a Discord activity) the Windows-like window can be moved around by dragging the title bar kodee loving
I've already pondered about the Compose HTML situation before, which is why I had a lot of talk about it It is a shame that it is an amazing library that it is hard for someone new to discover that it exists, considering that the only way for you to figure out that it exists is a link on Compose Multiplatform's README on GitHub
u
Yea I agree completely. Although I'd say "hey native dev, you can avoid the silly JS" is a big selling point