Compose world
The term Compose
can be misleading due to its use in multiple projects and frameworks, leading to potential confusion. Here's a brief explanation of some popular names to clarify what Kilua is - and what it isn't.
Jetpack Compose
Jetpack Compose, developed by Google, is the modern toolkit recommended for building native Android UIs. It streamlines and speeds up UI development using the Kotlin language. The framework is comprised of three main components: a compiler plugin, a runtime, and an UI toolkit.
Kilua is a web framework and doesn't target Android. It can't be used with Jetpack Compose.
Compose Multiplatform
Compose Multiplatform is a port of Jetpack Compose to other Kotlin targets, including desktop, Js, WasmJs and IOS (native). It's developed by JetBrains and its main goal is to provide a cross-platform solution for building applications with Compose. To achieve this goal all parts of Jetpack Compose have been ported to Kotlin MPP. Compose multiplatform has a unified rendering engine for its UI toolkit, which is based on Skia.
Kilua only uses Compose Multiplatform Runtime and it doesn't work with the Compose UI toolkit.
Compose compiler plugin
The compiler plugin is used to transform the code generated by the Kotlin compiler. It's main purpose is transforming functions annotated with @Composable
annotation for use with Compose runtime. Originally developed by Google, the compiler plugin has been merged into the Kotlin repository since Kotlin 2.0.0, and is now a part of the Kotlin compler itself.
All Kilua applications use Compose compiler plugin. You use the same Compose annotations when building Kilua apps.
Compose runtime
Compose runtime is a great library which provides the fundamental building blocks of Compose's programming model and state management. The runtime itself has no relation to the user interface. It can be used in applications which render some kind of UI (like Kilua) or not at all (e.g. Molecule). Compose runtime gives you functions to manage mutable state, snapshot system and life-cycle of composables.
Compose runtime is the foundation of Kilua framework. You can use all runtime features in your Kilua applications.
Compose web
Compose web is the name of that part of Compose Multiplatform which targets both Js and WasmJs, and is designed to build web applications for browsers. Compose web uses the Skia-based engine to render the UI on HTML canvas. Compose web allows you to use all Compose UI components (e.g. Material3 components) in your applications and also allows you to share the UI code between different targets. However, it has limitations related to the rendering process, which is not native to the web ecosystem. The main problems are SEO, accessibility, bundle size and reusing JS components (you can learn more from this article by David Herman).
Kilua is not using Compose Web and is not compatible with it. You cannot use Compose Web components in Kilua and vice versa. On the other hand, Kilua doesn't suffer from any of the major issues listed above.
Compose HTML
Compose HTML is a separate library, which is developed by JetBrains as part of Compose Multiplatform Github repository. It allows you to build web applications with Kotlin/Js compiler and compose runtime. Compose HTML apps are rendered with native DOM elements. Being a kind of predecessor of Compose Web, it gained its own extensions and ecosystem (with an impressive Kobweb framework at the forefront). Compose HTML is not Compose Web - it can't be used cross-platform and you can't use Compose Web components with Compose HTML.
Kilua is a bit similar to Compose HTML. You can think of it as a total rewrite of Compose HTML, with a new API and some unique features - mainly WasmJs support and Server Side Rendering (SSR). Still Kilua is not Compose HTML - you can't share components and can't use Kilua together with Compose HTML (or Kobweb).
Last updated