View Source LiveToast.Components (Live Toast v0.6.4)

This module defines the components used in the rendering of the default toast messages. You can use this as a reference to create your own version of these components.

Summary

Functions

Default toast function. Based on the look and feel of Sonner.

Functions

Default toast function. Based on the look and feel of Sonner.

You can use this as a reference to create your own toast component, that can be passed to the component option of LiveToast.send_toast/3.

Attributes

  • id (:string) - the optional id of flash container.
  • flash (:map) - the map of flash messages to display. Defaults to %{}.
  • title (:string) - Defaults to nil.
  • kind (:atom) - used for styling and flash lookup.Must be one of :info, or :error.
  • target (:any) - the target for the phx-click event. Defaults to nil.
  • duration (:integer) - the time in milliseconds before the message is automatically dismissed. Defaults to 6000.
  • toast_class_fn (:any) (required) - function to override the toast classes.
  • corner (:atom) (required) - the corner to display the toasts.
  • icon (:any) - the optional icon to render in the flash message. Defaults to nil.
  • action (:any) - the optional action to render in the flash message. Defaults to nil.
  • component (:any) - the optional component to render the flash message. Defaults to nil.
  • Global attributes are accepted. the arbitrary HTML attributes to add to the flash container.

Slots

  • inner_block - the optional inner block that renders the flash message.