LedgerUI.Components.ConnectionBanner (LedgerUI v0.2.0)

Copy Markdown View Source

The notice of a lost connection, as a toast: while the LiveView socket is down the toaster shows a loading toast with the ring of light (aura), and removes it when the socket is back.

<.connection_banner />
<.connection_banner title="Sem conexão" description="Tentando reconectar..." />

Put it once in the root layout, next to the <.toaster> (it needs one on the page). It draws nothing by itself and has no JavaScript of its own: phx-disconnected runs show_toast/2 and phx-connected runs dismiss_toast/1 (see LedgerUI.Components.Toast).

Summary

Functions

connection_banner(assigns)

Attributes

  • id (:string) - Defaults to "ledger-connection-banner".
  • title (:string) - Defaults to "Connection lost".
  • description (:string) - Defaults to "Trying to reconnect...".
  • color (:string) - The light of the ring. Defaults to "warning". Must be one of "assistant", "primary", "secondary", "info", "success", "warning", or "error".
  • Global attributes are accepted.