LanternUI.Components.Toast (LanternUI v0.8.7)

Copy Markdown View Source

Toast notification stack. Render once in a LiveView layout and push messages with LanternUI.send_toast/4.

placement positions the stack in any corner or edge-center; toasts enter from the nearest screen edge (sliding down from the top, up from the bottom). max controls how many cards remain visible while the stack is collapsed. Pass flash to bridge Phoenix :info and :error flashes into the deck.

<.toast_group placement="bottom-center" />
<.toast_group flash={@flash} />

Summary

Functions

toast_group(assigns)

Attributes

  • id (:string) - Stable DOM id for the toast stack hook. Defaults to "lantern-toasts".
  • placement (:string) - Corner or edge where the toast stack anchors. Defaults to "top-right". Must be one of "top-left", "top-center", "top-right", "bottom-left", "bottom-center", or "bottom-right".
  • max (:integer) - Maximum toast cards visible in the collapsed deck (1–10). Defaults to 3.
  • flash (:map) - Phoenix flash map; :info and :error render as toasts. Defaults to %{}.
  • class (:any) - Extra classes merged onto the root element. Defaults to nil.
  • Global attributes are accepted. Arbitrary HTML/phx-* attributes passed through.