Based on Google’s Jetpack Compose for Android, JetBrains’ Jetpack Compose for Desktop takes a declarative and reactive approach to creating user interfaces with Kotlin
JetBrains has published its first “milestone” release of Jetpack Compose for Desktop. Based on Google’s Jetpack Compose toolkit for Android UI development, the JetBrains framework provides a declarative and reactive approach to building UIs with Kotlin.
With an API inspired by frameworks such as React and Flutter, Jetpack Compose for Desktop enables the declarative creation of a desktop UI by combining composable functions. Application state is taken care of and visual representation synchronized by the framework.
The core APIs provided by Jetpack Compose for Desktop behave like their Android mobile counterparts, including UI elements and modifiers. After setting up project dependencies, developers can express a simple stateful user interface with a few lines of code and draw on a rich library of ready-to-use Material Design elements to flesh out the UI.
To ensure that the two technologies evolve together, the core of Jetpack Compose for Desktop is being developed in collaboration with the Google Jetpack Compose project. Developers can share significant parts of a UI implementation between the desktop and Android. Desktop-specific APIs are structured like Jetpack Compose APIs and allow an application to react to mouse pointer events, query and manipulate the size and positioning of application windows, and create tray icons or menu bar entries.
The first milestone was published November 5. A Getting Started tutorial for the framework is available. Jetpack Compose for Desktop integrates with Swing and AWT (Abstract Window Toolkit), providing the power of these Java APIs for Jetpack Compose for Desktop applications. Also featured is a significant part of the native Skia graphics library API, powering low-level rendering in Jetpack Compose for Desktop and allowing developers to control how their application is rendered.Paul Krill