M.WAQAS
12/18/2025, 3:57 PMSean Proctor
12/18/2025, 6:31 PM@Preview arguments. I do something like:
@Preview
@Composable
fun ExampleLightPreview() {
MyTheme(isDark = false) {
...
}
}
@Preview
@Composable
fun ExampleDarkPreview() {
MyTheme(isDark = true) {
...
}
}Sean Proctor
12/18/2025, 6:34 PMWindowSizeClass in a composition local, so when I want to test that, I can provide it there too. Or you could pass it in as an argument to whichever compose function you're testing if that makes more sense.M.WAQAS
12/18/2025, 6:34 PMpackage com.mlbench.truedrop.data.utils
import android.content.res.Configuration.UI_MODE_NIGHT_YES
import androidx.compose.ui.tooling.preview.Preview
@Preview(
name = "small font",
group = "font scales",
fontScale = 0.5f
)
@Preview(
name = "large font",
group = "font scales",
fontScale = 1.5f
)
annotation class FontScalePreviews
@Preview(
name = "phone",
group = "devices",
device = "spec:width=360dp,height=640dp,dpi=480"
)
@Preview(
name = "small_phone",
group = "devices",
device = "id:small_phone"
)
@Preview(
name = "foldable",
group = "devices",
device = "spec:width=673dp,height=841dp,dpi=480"
)
@Preview(
name = "tablet",
group = "devices",
device = "spec:width=1280dp,height=800dp,dpi=480"
)
annotation class DevicePreviews
@Preview(
name = "dark theme",
group = "themes",
uiMode = UI_MODE_NIGHT_YES,
showBackground = true
)
@FontScalePreviews
@DevicePreviews
annotation class CompletePreviewsSean Proctor
12/18/2025, 6:36 PMandroidMain, you just can't use it in common code.Sean Proctor
12/18/2025, 6:37 PM@Preview parameters are here: https://kotlinlang.org/docs/multiplatform/whats-new-compose-190.html#parameters-for-the-preview-annotationM.WAQAS
12/18/2025, 6:38 PMSean Proctor
12/18/2025, 6:39 PMM.WAQAS
12/18/2025, 6:40 PM