LoadingOverlay

fun LoadingOverlay(loading: Boolean, contentDescription: String, modifier: Modifier = Modifier, message: String? = null, showIndicator: Boolean = true, content: @Composable BoxScope.() -> Unit)

Hosts content and, while loading, covers it with a scrim that blocks interaction, for work the user started and must wait for (signing in, submitting, exporting).

While loading, every pointer event over content is swallowed, content leaves the accessibility tree, and contentDescription ("Signing in") is announced politely instead. With showIndicator, a card in the middle shows a spinner and the optional message; the message is visual only, so include it in contentDescription if screen reader users need it. Pass showIndicator = false when the triggering control already shows a spinner. For loads the user can keep working through, prefer LoadingState, ProgressIndicator, or a skeleton.

Keyboard focus moves to the scrim while loading and returns to the previously focused child afterward. Underlying controls cannot receive keyboard input or focus while loading.

The container sizes to content; pass Modifier.fillMaxSize() to cover a screen.