Skip to content

SusSnackbarQueue

SusSnackbarQueue

Serial toast host — enqueues messages and shows one SusSnackbar at a time.

Package

SusKit · Molecules (commercial)

Open in Playground

SusKit · Molecules

Props

NameTypeDefault
OverlayProp<bool>truev-model
LocationProp<string>"bottom-center"v-model

Slots

No slots.

Events

NameFieldPayload
EmptyOnEmpty
ShowOnShowstring

Style hooks

USS class contract — override appearance without touching C#. States toggle via these classes:

  • sus-snackbar-queue
  • sus-snackbar-queue__host

Usage

Drive the queue from code with Enqueue. XML only places the host and shared display props.

csharp
var queue = new SusSnackbarQueue();
queue.Overlay.Value = false;
queue.Location.Value = "bottom-center";
queue.OnShow += text => { /* … */ };
queue.OnEmpty += () => { /* … */ };

queue.Enqueue("Party invite received", "info", 2500);
queue.Enqueue("Saved", "success", 3000);
// or: queue.Enqueue(new SusSnackbarQueue.SnackbarQueueItem { Text = "…", Variant = "warning", Timeout = 4000 });
xml
<template>
  <sus:SusSnackbarQueue :Overlay="Overlay.Value"
                        :Location="Location.Value"
                        @show="OnShow"
                        @empty="OnEmpty" />
</template>

<script>
public Prop<bool> Overlay = new(true);
public Prop<string> Location = new("bottom-center");
void OnShow(string text) { /* … */ }
void OnEmpty() { }
// Call Enqueue from code (buttons, services, network handlers).
</script>
Prop / APIRole
OverlayPassed to each snackbar
LocationPassed to each snackbar (bottom-center, …)
Enqueue(text, variant, timeout)Append a toast
PendingCountPending + currently showing

Notes

  • Variants match SusSnackbar: info · success · warning · error.
  • Items enqueued before Mounted flush when the host mounts (Storybook Add→Enqueue race).
  • Prefer the queue over stacking many standalone snackbars.