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

The notification system for LiveView.

Summary

Types

Phoenix.Component that renders a part of the toast message.

Set of public options to augment the default toast behavior.

Functions

Helper function around send_toast/3 that is useful in pipelines.

Send a new toast message to the Shino.Notification component.

Types

@type component_fn() :: (map() -> Phoenix.LiveView.Rendered.t())

Phoenix.Component that renders a part of the toast message.

@type option() ::
  {:uuid, Ecto.UUID.t()}
  | {:duration, non_neg_integer()}
  | {:icon, component_fn()}
  | {:title, binary()}
  | {:action, component_fn()}
  | {:component, component_fn()}
  | {:group_id, binary()}

Set of public options to augment the default toast behavior.

Functions

Link to this function

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

View Source

Helper function around send_toast/3 that is useful in pipelines.

Unlike send_toast/3, this function does not expose the UUID of the new toast, so if you need to update the toast after showing it, you should use send_toast/3 directly.

Examples

iex> put_toast(socket, :info, "Thank you for logging in!")
%LiveView.Socket{...}
Link to this function

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

View Source
@spec send_toast(Shino.Notification.Base.kind(), binary(), [option()]) ::
  Ecto.UUID.t()

Send a new toast message to the Shino.Notification component.

Returns the UUID of the new toast message. This UUID can be passed back to another call to send_toast/3 to update the properties of an existing toast.

Examples

iex> send_toast(:info, "Thank you for logging in!", title: "Welcome")
"00c90156-56d1-4bca-a9e2-6353d49c974a"