Function: createToastQueue()
createToastQueue(
options?):ToastQueue<ToastContent>
Defined in: components/Toast/Toast.tsx:423
Factory for a typed toast queue. Call once (typically at module scope of
your app) and pass the result to <ToastRegion queue={queue} />.
The queue enforces the dismissal contract described in
resolveToastOptions: a supplied timeout is raised to at least 5s, and a
toast carrying an actionLabel never auto-dismisses.
Parameters
| Parameter | Type |
|---|---|
options? | { maxVisibleToasts?: number; } |
options.maxVisibleToasts? | number |
Returns
ToastQueue<ToastContent>
Example
import { createToastQueue } from '@ttoss/fsl-ui';
export const toastQueue = createToastQueue();
// Somewhere in your app:
toastQueue.add(
{ title: 'Saved', description: 'Your changes are live.', evaluation: 'positive' },
{ timeout: 5000 }
);
// Actionable — stays until the user answers it:
toastQueue.add({
title: 'Message archived',
actionLabel: undoLabel,
onAction: restoreMessage,
});