---
name: compose-multiplatform
description: "Compose Multiplatform reference: setup, entry points per platform, resources, navigation, and the Calf library for adaptive UI, file picker and permissions."
---

# Compose Multiplatform (CMP)


## Overview

Compose Multiplatform (CMP) is JetBrains' declarative UI toolkit built on Google's Jetpack Compose. It shares the Compose compiler and runtime and uses the same APIs (`@Composable`, `remember`, modifiers, layouts, animation), so Jetpack Compose knowledge carries over, and it runs on Android, iOS, desktop and web from common Kotlin code. It sits on top of [Kotlin Multiplatform](/programming/kotlin-multiplatform/).

**Latest: Compose Multiplatform 1.13.0** (2026-12-01). It moves to Kotlin 2.4.20 (minimum 2.4.0 for Kotlin/Native, 2.4.20 for Kotlin/JS and Wasm), raises the Android minimum SDK to 24 and needs `compileSdk` 37.1.

| Platform | Stability |
|---|---|
| Android | Stable |
| iOS | Stable |
| Desktop (JVM) | Stable |
| Web (Kotlin/Wasm) | Beta (the official stability page dates from September 2025; check it for the current level) |

## Setup

```text
Start a project   kmp.jetbrains.com (pick Android, iOS, Desktop, Web and "Share UI via Compose Multiplatform")
Ready-made link   https://kmp.jetbrains.com/?android=true&ios=true&desktop=true&web=true&iosui=compose&webui=compose&includeTests=true
Mobile only       https://kmp.jetbrains.com/?android=true&ios=true&iosui=compose&includeTests=true
IDE               Android Studio or IntelliJ IDEA with the Kotlin Multiplatform plugin
Check your Mac    brew install kdoctor && kdoctor
```

```kotlin
// shared UI module: build.gradle.kts
plugins {
    alias(libs.plugins.kotlin.multiplatform)
    alias(libs.plugins.android.kotlin.multiplatform.library)
    id("org.jetbrains.compose")                       // Compose Multiplatform Gradle plugin
    id("org.jetbrains.kotlin.plugin.compose")         // Compose compiler plugin (Kotlin 2.0 and newer)
}

kotlin {
    sourceSets {
        commonMain.dependencies {
            implementation(compose.runtime)
            implementation(compose.foundation)
            implementation(compose.material3)
            implementation(compose.components.resources)
        }
    }
}
```

The wizard generates platform app modules (`androidApp`, `iosApp`, `desktopApp`, `webApp`) and one shared UI module; every app module calls the shared `App()` composable. Compose Hot Reload lets you iterate on the UI quickly without restarting the app (the official tutorial runs it from the desktop app).

Keep Kotlin, Compose Multiplatform and your libraries on matching versions: library authors state a Kotlin and Compose pairing (see the Calf compatibility table below).

## Shared UI

```kotlin
// commonMain
@Composable
fun App() {
    MaterialTheme {
        var count by remember { mutableStateOf(0) }
        Column(Modifier.fillMaxSize().padding(16.dp)) {
            Text("Taps: $count")
            Button(onClick = { count++ }) { Text("Tap") }
        }
    }
}
```

## Entry Points

```kotlin
// Android: androidApp module
class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        enableEdgeToEdge()
        super.onCreate(savedInstanceState)
        setContent { App() }
    }
}
```

```kotlin
// iOS: iosMain
fun MainViewController() = ComposeUIViewController { App() }
```

```swift
// iOS: SwiftUI shell in the Xcode project
struct ComposeView: UIViewControllerRepresentable {
    func makeUIViewController(context: Context) -> UIViewController { MainViewControllerKt.MainViewController() }
    func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
}
```

```kotlin
// Desktop: jvmMain
fun main() = application {
    Window(onCloseRequest = ::exitApplication, title = "App") { App() }
}
```

```kotlin
// Web: webApp module
@OptIn(ExperimentalComposeUiApi::class)     // the web API requires opt-in
fun main() {
    ComposeViewport { App() }
}
```

Compose Multiplatform gives you all Jetpack Compose APIs, but [some are Android-only](https://kotlinlang.org/docs/multiplatform/compose-android-only-components.html). Entry points in depth: [native application entry points](https://kotlinlang.org/docs/multiplatform/compose-multiplatform-entry-points.html). In a larger app, pass platform dependencies into `App()` as parameters or through dependency injection.

## Jetpack Libraries in Common Code

```text
Fully multiplatform from Google   androidx.compose.runtime, androidx.annotation and others: use as is
Packaged by JetBrains             Compose UI, Foundation, Material 3, Navigation, Lifecycle, ViewModel
                                  published with the Android artifact under one group id: org.jetbrains.androidx.* / org.jetbrains.compose.*
Result                            Android uses the original AndroidX library, other targets use the JetBrains build
Material 3                        not tied to the Compose Multiplatform version: you can depend on it directly (for example an EAP)
Material 3 adaptive               standalone artifacts: org.jetbrains.compose.material3.adaptive
Extras from JetBrains             components.resources, components.uiToolingPreview (previews in common code),
                                  components.animatedimage, components.splitpane
```

Docs: [how multiplatform Jetpack libraries are packaged](https://kotlinlang.org/docs/multiplatform/compose-multiplatform-jetpack-libraries.html).

## Resources

Shared images, fonts and strings live in `composeResources` and are accessed through a generated `Res` class.

```text
src/commonMain/composeResources/
├── drawable/   images (PNG, JPEG, WebP, bitmap, Android vector XML)
├── font/       fonts
├── values/     strings.xml
└── files/      any other files
```

```kotlin
Text(stringResource(Res.string.app_name))
Image(painterResource(Res.drawable.logo), contentDescription = null)
```

Resources read synchronously in the caller thread, except raw files and web resources. Docs: [resources overview](https://kotlinlang.org/docs/multiplatform/compose-multiplatform-resources.html).

## Navigation

Use Navigation for Compose Multiplatform, or Decompose or Voyager. Docs: [navigation and routing](https://kotlinlang.org/docs/multiplatform/compose-navigation-routing.html).

## Platform Interop

| Need | Use |
|---|---|
| Native view inside Compose on Android | `AndroidView` |
| UIKit view inside Compose on iOS | `UIKitView` |
| Swing component inside Compose on desktop | `SwingPanel` |
| Platform-specific composable | `expect`/`actual` composable, or an interface passed in |
| Native-looking dialogs, pickers, permissions, WebView | [Calf](#calf-platform-apis-and-adaptive-ui) |
| iOS look and feel | [compose-cupertino](https://github.com/alexzhirkevich/compose-cupertino) (Cupertino widgets) |
| Mix with SwiftUI or UIKit | [SwiftUI integration](https://kotlinlang.org/docs/multiplatform/compose-swiftui-integration.html), [UIKit integration](https://kotlinlang.org/docs/multiplatform/compose-uikit-integration.html) |
| Mix with Swing on desktop | [Swing interoperability](https://kotlinlang.org/docs/multiplatform/compose-desktop-swing-interoperability.html) |
| Find a library | [klibs.io](https://klibs.io/): AI-powered search over 5,100+ KMP libraries |

## Calf: Platform APIs and Adaptive UI

[Calf](https://github.com/MohamedRejeb/Calf) (**C**ompose **A**daptive **L**ook & **F**eel, by Mohamed Rejeb, Apache 2.0) lets a Compose Multiplatform app use native UI and platform APIs from common code: adaptive components, a file picker, a WebView and runtime permissions, all behind one Compose API. Latest: **0.14.0** (2026-09-13). Docs: [mohamedrejeb.github.io/Calf](https://mohamedrejeb.github.io/Calf/installation/), live [web demo](https://calf-library.netlify.app/).

| Artifact | What it gives you | Platforms |
|---|---|---|
| `calf-ui` | Adaptive UI components | Android, iOS, Desktop, Web |
| `calf-file-picker` | Native file picker and saver | Android, iOS, Desktop, Web |
| `calf-webview` | WebView component | Android, iOS, Desktop, Web |
| `calf-permissions-*` | Runtime permissions, one module per permission | Android, iOS |
| `calf-cupertino-icons` | Cupertino icons everywhere | Android, iOS, Desktop, Web |
| geo, navigation, map, media, notification | Announced, not released yet | n/a |

### Calf Install

```kotlin
// commonMain dependencies
api("com.mohamedrejeb.calf:calf-ui:0.14.0")                           // adaptive UI
implementation("com.mohamedrejeb.calf:calf-file-picker:0.14.0")      // file picker
implementation("com.mohamedrejeb.calf:calf-webview:0.14.0")          // WebView
implementation("com.mohamedrejeb.calf:calf-permissions-core:0.14.0") // permissions base
implementation("com.mohamedrejeb.calf:calf-permissions-camera:0.14.0") // plus one module per permission you use
```

`calf-ui` must be exported to the iOS framework or it does not work on iOS:

```kotlin
kotlin {
    targets.filterIsInstance<KotlinNativeTarget>()
        .filter { it.konanTarget.family == Family.IOS }
        .forEach {
            it.binaries.framework {
                export("com.mohamedrejeb.calf:calf-ui:0.14.0")
            }
        }
}
```

| Kotlin | Compose Multiplatform | Calf |
|---|---|---|
| 2.4.20 | 1.12.0 | 0.14.0 |
| 2.4.10 | 1.11.1 | 0.13.0 |
| 2.3.20 | 1.10.3 | 0.12.0, 0.11.0, 0.10.0 |
| 2.2.21 | 1.9.2 | 0.9.0 |

Calf 0.14.0 is built on Compose Multiplatform 1.12, whose Android artifacts need `compileSdk = 37` (AGP 9.4 or newer); Calf's own `minSdk` stays 23. Check the repo's compatibility table before pairing it with a newer Compose Multiplatform.

### Adaptive UI

Components that look native on each platform (Material on Android, desktop and web; UIKit on iOS, including the iOS 26 liquid glass style): `AdaptiveAlertDialog`, `AdaptiveBasicAlertDialog`, `AdaptiveBottomSheet`, `AdaptiveCircularProgressIndicator`, `AdaptiveClickable`, `AdaptiveDatePicker`, `AdaptiveCompactDatePicker`, `AdaptiveDateRangePicker`, `AdaptiveTimePicker`.

```kotlin
var showDialog by remember { mutableStateOf(false) }
Button(onClick = { showDialog = true }) { Text("Show Alert Dialog") }

if (showDialog) {
    AdaptiveAlertDialog(          // native UIAlertController on iOS, Material dialog elsewhere
        onConfirm = { showDialog = false },
        onDismiss = { showDialog = false },
        confirmText = "OK",
        dismissText = "Cancel",
        title = "Alert Dialog",
        text = "This is a native alert dialog from Calf",
    )
}
```

Docs: [alert dialog](https://mohamedrejeb.github.io/Calf/ui/adaptive-alert-dialog/), [bottom sheet](https://mohamedrejeb.github.io/Calf/ui/adaptive-bottom-sheet/), [date picker](https://mohamedrejeb.github.io/Calf/ui/adaptive-date-picker/).

### File Picker

```kotlin
val scope = rememberCoroutineScope()
val pickerLauncher = rememberFilePickerLauncher(
    type = FilePickerFileType.Image,
    selectionMode = FilePickerSelectionMode.Single,
    onResult = { files ->
        scope.launch {
            files.firstOrNull()?.let { file ->
                val bytes = file.readByteArray()   // read the picked file on any platform
            }
        }
    },
)
Button(onClick = { pickerLauncher.launch() }) { Text("Open File Picker") }
```

Pass `onError = { error: FilePickerException -> ... }` to observe failures; cancelling is not a failure and returns an empty list. `FilePickerSettings(title, initialDirectory)` customizes the dialog. Docs: [file picker](https://mohamedrejeb.github.io/Calf/filepicker/).

### Permissions

Permissions are split into one module per permission on purpose: an iOS binary then links only the frameworks it uses, which avoids App Store rejections and unneeded `Info.plist` usage descriptions. Avoid the umbrella `calf-permissions` module for iOS releases.

```kotlin
val cameraPermissionState = rememberPermissionState(Permission.Camera)

if (cameraPermissionState.status.isGranted) {
    Text("Camera permission granted")
} else {
    Button(onClick = { cameraPermissionState.launchPermissionRequest() }) { Text("Request permission") }
}

// Several at once
val multiple = rememberMultiplePermissionsState(listOf(Permission.Camera, Permission.FineLocation))
if (!multiple.allPermissionsGranted) {
    Button(onClick = { multiple.launchMultiplePermissionRequest() }) { Text("Request permissions") }
}
```

Modules: `core`, `camera`, `microphone`, `gallery`, `location`, `background-location`, `bluetooth`, `contacts`, `calendar`, `notifications`, `wifi`. Add the matching entries to `AndroidManifest.xml` and the usage descriptions to the iOS `Info.plist`. Docs: [permissions](https://mohamedrejeb.github.io/Calf/permissions/).

### WebView

```kotlin
val state = rememberWebViewState(url = "https://example.com")

LaunchedEffect(Unit) { state.settings.javaScriptEnabled = true }   // needed for evaluateJavaScript

WebView(state = state, modifier = Modifier.fillMaxSize())
```

Wraps `WebView` on Android, `WKWebView` on iOS, JavaFX `WebView` on desktop and an `iframe` on web. It also offers `state.evaluateJavaScript(...)` and a `cookieManager`. Docs: [WebView](https://mohamedrejeb.github.io/Calf/webview/).

## Troubleshooting

| Symptom | Cause | Fix |
|---|---|---|
| Calf UI crashes or is missing on iOS | `calf-ui` not exported from the iOS framework | Add `export("com.mohamedrejeb.calf:calf-ui:<version>")` to the iOS framework block |
| Build fails with Kotlin or Compose version errors | Library built against another Kotlin or Compose version | Match the library's compatibility table |
| `compileSdk` error on Android | Compose Multiplatform 1.12 and newer need a recent `compileSdk` (37, 37.1 in 1.13) | Raise `compileSdk` and use a matching AGP |
| App Store rejects the iOS build for permissions | Linked permission frameworks the app never uses | Use per-permission Calf modules, not the umbrella module |
| Permission always denied on iOS | Missing `Info.plist` usage description | Add the usage string for that permission |
| `evaluateJavaScript` does nothing | JavaScript is disabled in the WebView | Set `state.settings.javaScriptEnabled = true` |
| Skottie animations stop working after 1.13 | Skottie left the Skiko core binary | Add `org.jetbrains.skiko:skiko-skottie` to `commonMain` |

## Quick Reference

| Item | Value |
|---|---|
| Plugins | `org.jetbrains.compose` and `org.jetbrains.kotlin.plugin.compose` |
| Android entry | `setContent { App() }` |
| iOS entry | `ComposeUIViewController { App() }` |
| Desktop entry | `application { Window(...) { App() } }` |
| Web entry | `ComposeViewport(document.body!!) { App() }` |
| Resources | `Res.string.x`, `Res.drawable.x` in `composeResources` |
| Calf group id | `com.mohamedrejeb.calf` |

## See Also

- [Get started with Compose Multiplatform](https://kotlinlang.org/docs/multiplatform/compose-multiplatform.html) - Official documentation start page
- [Native application entry points](https://kotlinlang.org/docs/multiplatform/compose-multiplatform-entry-points.html) and [fully shared code tutorial](https://kotlinlang.org/docs/multiplatform/compose-multiplatform-new-project.html)
- [klibs.io](https://klibs.io/) - Find Kotlin Multiplatform libraries
- [KMP Wizard, Android and iOS with shared UI](https://kmp.jetbrains.com/?android=true&ios=true&iosui=compose&includeTests=true) - A ready-made starting point; all parameters are listed on the [Kotlin Multiplatform](/programming/kotlin-multiplatform/#prefilled-wizard-links) page
- [Compose Multiplatform](https://www.jetbrains.com/compose-multiplatform/) and the [GitHub repo](https://github.com/JetBrains/compose-multiplatform) with release notes
- [Compose Multiplatform and Jetpack Compose](https://kotlinlang.org/docs/multiplatform/compose-multiplatform-and-jetpack-compose.html)
- [Stability of supported platforms](https://kotlinlang.org/docs/multiplatform/supported-platforms.html)
- [Calf](https://github.com/MohamedRejeb/Calf) - adaptive UI, file picker, WebView, permissions
- [compose-cupertino](https://github.com/alexzhirkevich/compose-cupertino) - Cupertino widgets
- [Kotlin Multiplatform](/programming/kotlin-multiplatform/) and [Kotlin](/programming/kotlin/)
- [Android quick reference](/links/android/) - Jetpack Compose, Android CLI and skills


---

Source: https://qref.eknath.dev/programming/compose-multiplatform/ (the same page as a QuickRef article; re-download to update)
