When to use it
Render one viewport at the app root and show toasts through its queue. Keep messages short and actions optional.
Stack timed notifications above the app inside the safe area.
Native example
Render one viewport at the app root and show toasts through its queue. Keep messages short and actions optional.
@Composable
fun UploadScreen(upload: suspend () -> Unit) {
val toasts = rememberLumenToastViewportState()
val scope = rememberCoroutineScope()
fun startUpload() {
scope.launch {
try {
upload()
toasts.show("Upload complete", "Your files are ready to share.", LumenBannerVariant.Success)
} catch (failure: IOException) {
toasts.show(
title = "Upload failed",
description = "Check your connection and try again.",
variant = LumenBannerVariant.Destructive,
action = LumenToastAction("Retry") { startUpload() }
)
}
}
}
Box(Modifier.fillMaxSize()) {
LumenButton(onClick = { startUpload() }, modifier = Modifier.padding(LumenSpacing.Lg)) {
LumenText("Upload files")
}
LumenToastViewport(toasts)
}
}Reference
The primary shared and platform-specific options exposed by LumenToastViewport.
| API | Values or type | Default | Description |
|---|---|---|---|
| placement / maxCount / duration | screen edge / visible toasts / auto-dismiss | bottom-center / 3 / 5000 ms | Render one viewport at the app root and show toasts through its queue. |
Native behavior
Render one viewport at the app root and show toasts through its queue. Keep messages short and actions optional.
Toasts announce by tone, pause while touched, and keep a named dismiss button.
Shared component