New Compose Multiplatform components arrived on Composables UICheck it out →

Component in Compose Ui



Composes an AWT/Swing component obtained from [factory]. The [factory] block will be called to obtain the [Component] to be composed.

The Swing component is placed on top of the Compose layer (that means that Compose content can't overlap or clip it). This can be changed in the future, when the better interop with Swing will be implemented. See related issues:

The [update] block runs due to recomposition, this is the place to set [Component] properties depending on state. When state changes, the block will be reexecuted to set the new properties.

Last updated:


dependencies {


fun <T : Component> SwingPanel(
    background: Color = Color.White,
    factory: () -> T,
    modifier: Modifier = Modifier,
    update: (T) -> Unit = NoOpUpdate


backgroundBackground color of SwingPanel
factoryThe block creating the [Component] to be composed.
modifierThe modifier to be applied to the layout.
updateThe callback to be invoked after the layout is inflated.