Toast.LiveComponent (Toast v0.2.0)
View SourceThe LiveComponent that manages toast notifications using Phoenix streams.
This component is typically not used directly. Instead, use the Toast.toast_group/1
function component which wraps this LiveComponent.
State Management
The component maintains toasts using LiveView streams, which provides:
- Efficient DOM updates
- Automatic animations via phx-update="stream"
- Server-side state management
Events
The component handles the following events:
"clear"- Removes a specific toast by ID"clear-flash"- Removes a flash message"clear-all"- Removes all toasts"action"- Handles toast action button clicks