PreviewLabPreview
interface PreviewLabPreview
Have me.tbsten.compose.preview.lab.gallery.previewlist.PreviewTreeNode.Preview information collected by gradle plugin. It can be used to display the Preview catalog by passing it to PreviewLabGallery.
// generated by gradle plugin
package myApp
object PreviewList : List<CollectedPreview> by listOf(...)
// user code
fun MyAppEntryPoint() {
ComposePreviewLabGallery(
previewList = myApp.PreviewList,
)
}Content copied to clipboard
In addition to collecting from the gradle plugin, you can also use the CollectedPreview function to represent a pseudo-Preview.
fun MyAppEntryPoint() {
ComposePreviewLabGallery(
previews = myAppPreviews + listOf(
CollectedPreview(
displayName = "MyButtonPreview",
filePath = "myApp/src/main/kotlin/myApp/MyButtonPreview.kt",
startLineNumber = 10,
code = null,
) {
MyButton(text = fieldValue { StringField("Click!") })
},
),
)
}Content copied to clipboard
See also
Inheritors
Properties
Link copied to clipboard
The content of Preview. You can display the content of Preview by calling invoke().
Link copied to clipboard
The value set to displayName of the ComposePreviewLabOption annotation.
Link copied to clipboard
The ending line number of Preview (1-based, inclusive).
Link copied to clipboard
The starting line number of Preview (1-based).