Google's modern declarative UI toolkit for Android — and beyond. Same Kotlin code can target Android, desktop, web, and (via Compose Multiplatform) iOS.
← Back to Client Side@Composable describe UI for given inputs.Modifier.padding(...).clickable { ... }.@Composable fun ProductList(viewModel: ProductViewModel = viewModel()) { val state by viewModel.state.collectAsState() Scaffold(topBar = { TopAppBar(title = { Text("Products") }) }) { padding -> when { state.isLoading -> CircularProgressIndicator(Modifier.padding(padding)) else -> LazyColumn(Modifier.padding(padding)) { items(state.products, key = { it.id }) { p -> ListItem( headlineContent = { Text(p.name) }, trailingContent = { Text("$" + p.price) }, ) } } } } }
remember { mutableStateOf(...) } creates state that survives recomposition. Reading the state inside a composable subscribes that composable to changes — only it re-runs on update. Pair with StateFlow from a ViewModel for app-level state.
Modifiers are the workhorse — padding, size, background, click, focus, semantics. Order matters: Modifier.padding(8.dp).background(Red) ≠ Modifier.background(Red).padding(8.dp).
LaunchedEffect — coroutine tied to the composable's lifecycle.rememberCoroutineScope — scope for event-driven coroutines.DisposableEffect — cleanup on dispose.produceState / derivedStateOf — derived state.animate*AsState functions interpolate values; AnimatedVisibility, Crossfade, and the animateContentSize modifier cover most UI animations declaratively.
JetBrains' fork extends Compose to iOS, desktop (JVM), and web (Wasm). Share UI code across all four platforms while keeping native performance — the most ambitious cross-platform UI story in the Kotlin world.
| Library | Purpose |
|---|---|
| Material 3 | Components & theming. |
| Navigation Compose | Type-safe routing between screens. |
| Hilt | Dependency injection. |
| Coil | Image loading for Compose. |
| Accompanist | Pager, permissions, system UI helpers. |
The Google-blessed default for greenfield Android.
Compose for Wear is the modern path for watch UIs.
Share UI across Android + iOS + desktop with Compose Multiplatform.
Material You theming & components without third-party libs.