withEvent

fun PreviewLabScope.withEvent(title: String, description: String? = null, block: () -> Unit = {}): () -> Unit
fun <Arg1> PreviewLabScope.withEvent(title: String, description: String? = null, block: (Arg1) -> Unit = {}): (Arg1) -> Unit
fun <Arg1, Arg2> PreviewLabScope.withEvent(title: String, description: String? = null, block: (Arg1, Arg2) -> Unit): (Arg1, Arg2) -> Unit
fun <Arg1, Arg2, Arg3> PreviewLabScope.withEvent(title: String, description: String? = null, block: (Arg1, Arg2, Arg3) -> Unit): (Arg1, Arg2, Arg3) -> Unit

Create a function to record events. This is simply a short-hand for the onEvent call.

PreviewLab {
var text by fieldState {StringField("text", "") }
TextField(
value = text,
onValueChange = withEvent("text changed") { text = it },
)
}

Parameters

title

title of the event to be passed to onEvent.

description

description of the event to be passed to onEvent.

block

Processing to be generated after the event is sent.