Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Year of Compose Multiplatform Preview Tooling...

A Year of Compose Multiplatform Preview Tooling Improvements - We're Almost There*!

Not so long ago, working with Compose Multiplatform previews could feel… character-building. Previewing composables from common code often meant jumping through awkward hoops. On top of that, the tooling was lacking in features that Jetpack Compose tooling already had in place for a while.

Over the past year, that’s changed drastically. We've got a new KMP plugin, CMP preview support in common code, Hot Reload, and a lot more refreshing updates.

Join me on this journey to review the advancements made regarding Compose Multiplatform previews in 2025 so far and to have a glimpse at what's yet to come!

Avatar for István Juhos

István Juhos

October 11, 2025
Tweet

More Decks by István Juhos

Other Decks in Programming

Transcript

  1. @Preview(device = "spec:width=960dp,height=1080dp,dpi=480") @Composable private fun TitleSlidePreview() { PreviewBox {

    TitleSlide() } } @Composable private fun TitleSlide() { Column( modifier = Modifier .fillMaxSize() .paint( painter = painterResource( id = R.drawable.glenn_carstens_peters, ), contentScale = ContentScale.FillBounds, ) .padding(32.dp) ) { Title( modifier = Modifier .fillMaxWidth() .padding(top = 32.dp), fontSize = 70.sp, ) Column( horizontalAlignment = CenterHorizontally, modifier = Modifier .fillMaxWidth() ) { Name( modifier = Modifier .weight(1f) .padding(bottom = 66.dp), imageHeight = 66.dp, textSize = 70.sp, ) Contacts( modifier = Modifier .padding( bottom = 16.dp, end = 16.dp, ), fontSize = 50.sp, ) } } } Practical Tips and Tricks to Improve Your Compose Previews István Juhos @istvanjuhos.dev
  2. @istvanjuhos.dev #DevFestVenezia No multipreview support yet @Preview @Preview annotation class

    PreviewPrimaryBackground @PreviewLightDark @PreviewFontScale @Previe w​ ScreenSizes @PreviewDynamicColors 😢 ❌
  3. @istvanjuhos.dev #DevFestVenezia @PreviewLightDark @Composable private fun PrimaryButtonPreview() { AppTheme {

    PrimaryButton( text = "Primary Button", leadingIcon = R.drawable.ic_add, onClick = {}, ) } } Missing flexibility 💧 🫸
  4. @istvanjuhos.dev #DevFestVenezia February Kotlin Multiplatform Tooling - Shifting Gears jetbrains.com/

    fl eet blog.jetbrains.com/kotlin/2025/02/kotlin-multiplatform-tooling-shifting-gears
  5. @istvanjuhos.dev #DevFestVenezia February Kotlin Multiplatform Tooling - Shifting Gears jetbrains.com/

    fl eet blog.jetbrains.com/kotlin/2025/02/kotlin-multiplatform-tooling-shifting-gears
  6. @istvanjuhos.dev #DevFestVenezia February Kotlin Multiplatform Tooling - Shifting Gears jetbrains.com/

    fl eet blog.jetbrains.com/kotlin/2025/02/kotlin-multiplatform-tooling-shifting-gears
  7. @istvanjuhos.dev #DevFestVenezia February Kotlin Multiplatform Tooling - Shifting Gears jetbrains.com/

    fl eet blog.jetbrains.com/kotlin/2025/02/kotlin-multiplatform-tooling-shifting-gears
  8. Compose Multiplatform for Desktop IDE Support • Basic previews in

    modules targeting the JVM • Entered maintenance mode, phasing out May
  9. May Kotlin Multiplatform plugin (Beta) • Starting with IDEA 2025.1.1

    and AS Narwhal • Only on 🍎 for now, 🪟 and 🐧 coming soon • Intro blog post blog.jetbrains.com/kotlin/2025/05/kotlin-multiplatform-tooling-now-in-intellij-idea-and-android-studio/
  10. May Kotlin Multiplatform plugin (Beta) • Starting with IDEA 2025.1.1

    and AS Narwhal • Only on 🍎 for now, 🪟 and 🐧 coming soon • Intro blog post blog.jetbrains.com/kotlin/2025/05/kotlin-multiplatform-tooling-now-in-intellij-idea-and-android-studio/
  11. @istvanjuhos.dev #DevFestVenezia androidx.compose.ui.tooling.preview.Preview • To be used in Android source

    sets • Supported in Android Studio / IDEA via the Android plugin May
  12. @istvanjuhos.dev #DevFestVenezia org.jetbrains.compose.ui.tooling.preview.Preview • Introduced in CMP 1.6.0, initially for

    Fleet • Usable anywhere where declaring composables is possible • Supported in Android Studio and IDEA via the • Compose Multiplatform for Desktop IDE Support plugin • Kotlin Multiplatform plugin May
  13. @istvanjuhos.dev #DevFestVenezia Preview annotation parameters android x​ .compose.ui.tooling.preview org.jetbrain s​

    .compose.ui.tooling.preview @Preview( name = "", group = "", widthDp = 300, heightDp = 200, locale = "it_IT", showBackground = true, backgroundColor = 0xFFE7ECF4, showSystemUi = true, fontScale = 1f, apiLevel = 35, uiMode = UI_MODE_NIGHT_YES, device = PIXEL_9_PRO_FOLD, wallpaper = GREEN_DOMINATED_EXAMPLE, ) @Preview( name = "", group = "", widthDp = 360, heightDp = 640, locale = "it_IT", showBackground = true, backgroundColor = 0xFFFFFF, ) July
  14. @istvanjuhos.dev #DevFestVenezia Preview annotation parameters android x​ .compose.ui.tooling.preview org.jetbrain s​

    .compose.ui.tooling.preview @Preview( name = "", group = "", widthDp = 300, heightDp = 200, locale = "it_IT", showBackground = true, backgroundColor = 0xFFE7ECF4, showSystemUi = true, fontScale = 1f, apiLevel = 35, uiMode = UI_MODE_NIGHT_YES, device = PIXEL_9_PRO_FOLD, wallpaper = GREEN_DOMINATED_EXAMPLE, ) @Preview( name = "", group = "", widthDp = 360, heightDp = 640, locale = "it_IT", showBackground = true, backgroundColor = 0xFFFFFF, ) July
  15. @istvanjuhos.dev #DevFestVenezia Preview annotation parameters android x​ .compose.ui.tooling.preview org.jetbrain s​

    .compose.ui.tooling.preview @Preview( name = "", group = "", widthDp = 300, heightDp = 200, locale = "it_IT", showBackground = true, backgroundColor = 0xFFE7ECF4, showSystemUi = true, fontScale = 1f, apiLevel = 35, uiMode = UI_MODE_NIGHT_YES, device = PIXEL_9_PRO_FOLD, wallpaper = GREEN_DOMINATED_EXAMPLE, ) @Preview( name = "", group = "", widthDp = 360, heightDp = 640, locale = "it_IT", showBackground = true, backgroundColor = 0xFFFFFF, ) July
  16. @istvanjuhos.dev #DevFestVenezia Multipreview support with CMP org.jetbrain s​ .compose.ui.tooling.preview @Preview(

    name = "Example preview name", group = "Example preview group", showBackground = true, backgroundColor = GRAY_W500, widthDp = 1080, heightDp = 1920, locale = "it_IT", ) CMP 1.9-beta01+ July
  17. @istvanjuhos.dev #DevFestVenezia Multipreview support with CMP org.jetbrain s​ .compose.ui.tooling.preview @Preview(

    name = "Example preview name", group = "Example preview group", showBackground = true, backgroundColor = GRAY_W500, widthDp = 1080, heightDp = 1920, locale = "it_IT", ) CMP 1.9-beta01+ July
  18. @istvanjuhos.dev #DevFestVenezia Multipreview support with CMP org.jetbrain s​ .compose.ui.tooling.preview @Preview(

    name = "Example preview name", group = "Example preview group", showBackground = true, backgroundColor = GRAY_W500, widthDp = 1080, heightDp = 1920, locale = "it_IT", ) CMP 1.9-beta01+ July
  19. @istvanjuhos.dev #DevFestVenezia Multipreview examples - MultiLocalePreview @Preview( name = "Greek",

    group = "Locale", locale = "el", ) ... @Preview( name = "Portuguese", group = "Locale", locale = "pt", ) @Preview( name = "Arabic", group = "Locale", locale = "ar", ) @Preview( name = "(Default locale)", group = "Locale", ) annotation class MultiLocalePreview
  20. @istvanjuhos.dev #DevFestVenezia Preview annotation parameters android x​ .compose.ui.tooling.preview org.jetbrain s​

    .compose.ui.tooling.preview @Preview( name = "", group = "", widthDp = 300, heightDp = 200, locale = "it_IT", showBackground = true, backgroundColor = 0xFFE7ECF4, showSystemUi = true, fontScale = 1f, apiLevel = 35, uiMode = UI_MODE_NIGHT_YES, device = PIXEL_9_PRO_FOLD, wallpaper = GREEN_DOMINATED_EXAMPLE, ) @Preview( name = "", group = "", widthDp = 360, heightDp = 640, locale = "it_IT", showBackground = true, backgroundColor = 0xFFFFFF, ) July
  21. CMP 1.10.0-alpha02 - Reduce Preview annotation variety • Using @androidx.compose.ui.tooling.preview.Preview

    in common code • Eventually deprecating and removing the rest October
  22. CMP 1.10.0-alpha02 - Reduce Preview annotation variety • Using @androidx.compose.ui.tooling.preview.Preview

    in common code • Eventually deprecating and removing the rest October
  23. Where? • No more jumping through hoops to have proper

    CMP Previews • CMP Previews working in common code like in a pure Android project • Same behavior in IDEA and AS 😎