跳到內容
調色盤星雲光譜
選擇版面配色

即時套用,保留目前的亮暗模式。

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:預設 5000ms;設為 0 可保持顯示。滑鼠停留或焦點位於通知內時會暫停倒數,兩者都離開後才接續剩餘時間。
  • 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/ 範例。