or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

collections.mdcomposition.mdeffects.mdindex.mdstate-management.md
tile.json

tessl/maven-org-jetbrains-compose-runtime--runtime-desktop

Tree composition support and runtime infrastructure for Compose Multiplatform desktop applications with declarative UI development APIs.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.jetbrains.compose.runtime/runtime-desktop@1.8.x

To install, run

npx @tessl/cli install tessl/maven-org-jetbrains-compose-runtime--runtime-desktop@1.8.0

index.mddocs/

Compose Runtime Desktop

Compose Runtime Desktop provides the core runtime infrastructure for building declarative user interfaces with Compose Multiplatform on desktop platforms (Windows, macOS, Linux). It includes tree composition support, state management, recomposition logic, and the foundational APIs needed for reactive UI development.

Package Information

  • Package Name: org.jetbrains.compose.runtime:runtime-desktop
  • Package Type: maven
  • Language: Kotlin
  • Target Platform: JVM Desktop (Windows, macOS, Linux)
  • Installation: Add to your build.gradle.kts dependencies
dependencies {
    implementation("org.jetbrains.compose.runtime:runtime-desktop:1.8.2")
}

Core Imports

import androidx.compose.runtime.*

For specific functionalities:

import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.produceState

Basic Usage

import androidx.compose.runtime.*

@Composable
fun Counter() {
    var count by remember { mutableStateOf(0) }
    
    Button(
        onClick = { count++ }
    ) {
        Text("Count: $count")
    }
}

@Composable
fun App() {
    var name by remember { mutableStateOf("World") }
    
    Column {
        TextField(
            value = name,
            onValueChange = { name = it },
            label = { Text("Name") }
        )
        Text("Hello, $name!")
    }
}

Architecture

Compose Runtime Desktop is built around several key components:

  • Composition Engine: The core system that manages the composition tree and recomposition process
  • State System: Reactive state management with automatic recomposition triggering
  • Effect System: APIs for side effects, lifecycle management, and external system integration
  • Snapshot System: Isolated state observation and mutation tracking
  • CompositionLocal: Context-like implicit value propagation through the composition tree

Capabilities

State Management

Core state management APIs for creating reactive UI state that automatically triggers recomposition when changed.

fun <T> mutableStateOf(
    value: T,
    policy: SnapshotMutationPolicy<T> = structuralEqualityPolicy()
): MutableState<T>

interface State<out T> {
    val value: T
}

interface MutableState<T> : State<T> {
    override var value: T
}

State Management

Effects and Lifecycle

Side effect APIs for integrating with external systems, managing resources, and handling component lifecycle.

@Composable
fun LaunchedEffect(
    vararg keys: Any?,
    block: suspend CoroutineScope.() -> Unit
)

@Composable
fun DisposableEffect(
    vararg keys: Any?,
    effect: DisposableEffectScope.() -> DisposableEffectResult
)

@Composable
fun SideEffect(effect: () -> Unit)

Effects and Lifecycle

Composition and Context

Core composition APIs for building composable functions and managing implicit context propagation.

@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE)
@Retention(AnnotationRetention.BINARY)
annotation class Composable

@Composable
fun <T> remember(calculation: () -> T): T

@Composable
fun CompositionLocalProvider(
    vararg values: ProvidedValue<*>,
    content: @Composable () -> Unit
)

Composition and Context

Collections and Observables

Reactive collections and observable data structures that integrate with the composition system.

fun <T> mutableStateListOf(vararg elements: T): SnapshotStateList<T>

fun <K, V> mutableStateMapOf(vararg pairs: Pair<K, V>): SnapshotStateMap<K, V>

@Composable
fun <T> Flow<T>.collectAsState(
    initial: T,
    context: CoroutineContext = EmptyCoroutineContext
): State<T>

Collections and Observables