# ToastQueue (@salmonui/notifications/toast)

> The ToastQueue interface of @salmonui/notifications/toast: A toast queue: create one with createToastQueue() or let Toaster create it.

Canonical: https://salmonui.dev/docs/reference/notifications/toast/ToastQueue

```ts
import type { ToastQueue } from '@salmonui/notifications/toast';
```

Entry index: https://salmonui.dev/docs/reference/notifications/toast (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/notifications/toast.md).

## Reference

Kind: interface

```ts
interface ToastQueue {
    add(options: ToastOptions): string;
    update(id: string, options: ToastOptions): void;
    dismiss(id?: string, reason?: ToastCloseReason): void;
    pause(): void;
    resume(): void;
    setMax(max: number): void;
    subscribe(listener: () => void): () => void;
    getSnapshot(): ToastQueueSnapshot;
}
```

A toast queue: create one with `createToastQueue()` or let `Toaster` create it.

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `add` | `add(options: ToastOptions): string;` |  | Adds a toast and returns its id. A no-op returning `''` on the server. |
| `update` | `update(id: string, options: ToastOptions): void;` |  | Merges options into a toast; a new `duration` restarts its timer. |
| `dismiss` | `dismiss(id?: string, reason?: ToastCloseReason): void;` |  | Closes a toast, or every toast without an id (waiting toasts leave silently). `reason` defaults to `'programmatic'`. |
| `pause` | `pause(): void;` |  | Pauses every timer; calls nest, each `pause()` needs a `resume()`. |
| `resume` | `resume(): void;` |  | Undoes one `pause()`; timers continue with their remaining time. |
| `setMax` | `setMax(max: number): void;` |  | Sets the number of visible toasts. |
| `subscribe` | `subscribe(listener: () => void): () => void;` |  |  |
| `getSnapshot` | `getSnapshot(): ToastQueueSnapshot;` |  |  |
