collectAllModulePreviews

Returns a Lazy that provides the list of @Preview functions collected from this module and all dependency modules that export their preview properties.

The compiler plugin replaces the Lazy initializer at compile time with a concatenation of this module's previews and the values of dependency modules' exported preview properties. Dependency modules are discovered via the collectPreviewsExport Gradle configuration.

Example — app module aggregating its own and library previews:

// app/src/commonMain/kotlin/Previews.kt
val appPreviews by collectAllModulePreviews()

Example — dependency module exporting its previews via Gradle:

// uiLib/build.gradle.kts
composePreviewLab {
collectPreviewsExport = "uiLib.uiLibPreviews"
}

Return

a Lazy wrapping the aggregated preview list; the initializer is replaced by the compiler plugin

See also