action

Composable Function

Android
@Composable
fun action(
    key: String? = null,
    block: () -> Unit,
): Action

Create an Action that runs block when triggered.

Parameters

keyA stable and unique key that identifies this action. This key is saved in the PendingIntent for the UI element, and used to trigger this action when the element is clicked. If not provided we use androidx.compose.runtime.currentCompositeKeyHash as the key. Since that key is based on the location within the composition, it will be identical for lambdas generated in a loop (if not using androidx.compose.runtime.key). To avoid this, prefer setting explicit keys for your lambdas.
blockthe function to be run when this action is triggered.