Toast (Toast v0.0.1)
View SourceServer-rendered toast notifications for Phoenix LiveView.
This module provides the main API for sending toast notifications that are managed server-side using LiveView streams.
Summary
Functions
Clears all toasts.
Clears a specific toast by ID.
Sends a toast notification and updates the flash. Used for toasts that should persist across live navigation.
Sends a toast notification to the LiveComponent.
Updates an existing toast by ID.
Types
@type t() :: %Toast{ action: map() | nil, close_button: boolean(), description: String.t() | nil, duration: integer() | nil, icon: String.t() | nil, id: String.t(), important: boolean(), message: String.t(), position: atom() | nil, title: String.t() | nil, type: :info | :success | :error | :warning | :loading | :default }
Functions
Clears all toasts.
Clears a specific toast by ID.
Sends a toast notification and updates the flash. Used for toasts that should persist across live navigation.
Sends a toast notification to the LiveComponent.
Examples
LiveToast.send_toast(:info, "Operation completed!")
LiveToast.send_toast(:error, "Something went wrong", title: "Error", duration: 10_000)
Updates an existing toast by ID.
Examples
Toast.update_toast("toast-123", message: "Updated message", type: :success)
Toast.update_toast("toast-123", title: "New Title", duration: 10_000)