OctantisWeb.Components.AppBridge.Toast (octantis v0.1.12)

View Source

Renders Shopify toast notices.

Uses ShopifyToastHook to integrate with AppBridge https://shopify.dev/docs/api/app-bridge-library/reference/toast#example-toast-with-dismiss-callback

Be sure to load in AppBridge js in your template (you can use <OctantisWeb.Components.Head.javascript /> to do so).

Examples

<.toast kind={:info} flash={@flash} id="toastinfo" />
<.toast kind={:error} flash={@flash} id="toasterror" />

Summary

Functions

Attributes

  • id (:string) - the optional id of toast container. Defaults to "toast".
  • flash (:map) - the map of flash messages to display. Defaults to %{}.
  • kind (:atom) - used for styling and flash lookup.Must be one of :info, or :error.
  • phx_hook (:string) - The hook to handle onDismiss. Defaults to "ShopifyToastHook".

Functions

toast(assigns)

Attributes

  • id (:string) - the optional id of toast container. Defaults to "toast".
  • flash (:map) - the map of flash messages to display. Defaults to %{}.
  • kind (:atom) - used for styling and flash lookup.Must be one of :info, or :error.
  • phx_hook (:string) - The hook to handle onDismiss. Defaults to "ShopifyToastHook".