View Source Shino.Notification.LiveComponent (shino v0.2.0-alpha.1)
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
@spec put_toast( Phoenix.LiveView.Socket.t(), Shino.Notification.Base.kind(), binary(), [option()] ) :: Phoenix.LiveView.Socket.t()
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{...}
@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"