View Source LiveToast.Components (Live Toast v0.9.0)
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.
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.uuid(:string) - the UUID for the toast. Defaults tonil.flash(:map) - the map of flash messages to display. Defaults to%{}.title(:string) - Defaults tonil.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 tonil.delay(:integer) - adds a delay before being shown. not exposed by default, used only for 'client-error' and 'server-error'. Defaults to0.duration(:any) - the time in milliseconds before the message is automatically dismissed. Defaults to6000.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 tonil.action(:any) - the optional action to render in the flash message. Defaults tonil.component(:any) - the optional component to render the flash message. Defaults tonil.metadata(:map) - application-defined data passed to a custom toast component. Defaults to%{}.dismissible(:boolean) - whether the toast can be dismissed manually. Defaults totrue.flash_duration(:integer) - if provided clears flash after provided milliseconds. Defaults to0.- 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.