Show a message
Launch showSnackbar from a coroutine scope tied to the composition.
val hostState = remember { SnackbarHostState() }
val scope = rememberCoroutineScope()
Box {
Button(onClick = {
scope.launch { hostState.showSnackbar("Message sent") }
}) { Text("Send") }
SnackbarHost(hostState, Modifier.align(Alignment.BottomCenter))
}