TermUI.Widgets.ToastManager (TermUI v0.2.0)
View SourceManages multiple toast notifications with stacking.
ToastManager handles the lifecycle of multiple toasts, including stacking, auto-dismiss, and position management.
Usage
# Create manager
{:ok, manager} = ToastManager.init(%{position: :bottom_right})
# Add toasts
manager = ToastManager.add_toast(manager, "File saved", :success)
manager = ToastManager.add_toast(manager, "Warning: Low disk space", :warning)
# Update (check auto-dismiss)
manager = ToastManager.tick(manager)
Summary
Functions
Adds a new toast to the manager.
Clears all toasts.
Gets all visible toasts.
Creates a new ToastManager.
Renders all toasts with stacking.
Updates the manager, removing dismissed toasts.
Gets the count of visible toasts.
Functions
Adds a new toast to the manager.
Clears all toasts.
Gets all visible toasts.
Creates a new ToastManager.
Renders all toasts with stacking.
Returns a list of overlay nodes that should be rendered. Each toast is an overlay with absolute positioning.
Updates the manager, removing dismissed toasts.
@spec toast_count(map()) :: non_neg_integer()
Gets the count of visible toasts.