View Source Shino.Notification (shino v0.1.1-alpha.0)

A drop-in replacement for notification system in Phoenix.

Usage

Add following components to your app.html.heex:

<Shino.Notification.connection_group position={:top} />
<Shino.Notification.notification_group flash={@flash} connected={assigns[:socket] != nil} />

Then, use following functions to send flash or toast:

  • put_flash/3
  • Shino.Notification.put_toast/_
  • Shino.Notification.send_toast/_

Summary

Functions

Link to this function

connection_group(assigns)

View Source

See Shino.Notification.System.connection_group/1.

Link to this function

notification_group(assigns)

View Source

Renders a notification group for DeadView and LiveView.

  • For DeadView, it only renders flashes.
  • For LiveView, it renders flashes and toasts.

Attributes

  • id (:string) - the DOM id of notification group. Defaults to "notification-group".
  • position (:atom) - the location for showing notifications. Defaults to :bottom_right.
  • flash (:map) (required) - the map of flash messages.
  • connected (:boolean) - Defaults to false.
Link to this function

put_toast(socket, kind, message, options \\ [])

View Source

See Shino.Notification.LiveComponent.put_toast/4.

Link to this function

send_toast(kind, message, options \\ [])

View Source

See Shino.Notification.LiveComponent.send_toast/3.