跳到內容

Toast (am-toast)

am-toastToastProvider 提供全域通知 API(window.toast)。

  • 在 layout 掛載 <ToastProvider />
  • window.toast.show(title, options?)
  • window.toast.info(title, options?)
  • window.toast.success(title, options?)
  • window.toast.warning(title, options?)
  • window.toast.error(title, options?)

options 目前支援:

  • description?: string
  • type?: "info" | "success" | "warning" | "error" (show only)
  • duration?: number
  • closable?: boolean
<ToastProvider />
window.toast?.success("Completed", {
description: "All components have been updated.",
duration: 4000,
});

目前 contract 是 client-side global provider,不是可序列化的 page block。

詳見 playground /playground/toast/ 範例。