Toast
Short news about what just happened, in a corner, for a few seconds. Specification: docs/components/toast.md
Basics
A .canon-toast: a title, an optional description and actions, a close button. data-intent picks its icon, in the same words as a Button's: info, success, warning, danger; none for plain news. Here as they look (in the page, not shown as toasts).
Invoice saved
INV-2041 is up to date.
Reminder scheduled
Globex gets it tomorrow at 9:00.
Sync is slow
Changes may take a few minutes to appear.
Couldn't save the invoice
Your connection dropped. Try again.
Link copied
Invoice deleted
Emphasis
data-emphasis="high": solid, for the rare toast that must be noticed (a failure that lost work, a sync that stopped). In the same words as a Button's. Without an intent it is the page's colors inverted. Most toasts stay at the default.
Reminder scheduled
Globex gets it tomorrow at 9:00.
Invoice saved
INV-2041 is up to date.
Sync is slow
Changes may take a few minutes to appear.
Couldn't save the invoice
Your connection dropped. Try again.
Link copied
Sync stopped
12 changes are waiting.
Showing one
A Button with command="--canon-toast" and commandfor a <template> holding the toast shows a copy in the toaster, at the window's bottom-end corner. It goes after 5 seconds; the time stops while the pointer or focus is on it. The last one stays until you close it (data-duration="none").
Invoice saved
INV-2041 is up to date.
Reminder scheduled
Globex gets it tomorrow at 9:00.
Sync is slow
Changes may take a few minutes to appear.
Couldn't save the invoice
Your connection dropped. Try again.
Link copied
Export ready
It stays until you close it.
A timer
data-timer (or timer: true in the event): a line along the bottom runs out with the toast's time, so people can see it's going. It stops while the pointer or focus is on the toaster (the toast is data-paused), as the time does: hover one to try.
Invoice saved
INV-2041 is up to date.
Invoice deleted
Couldn't save the invoice
Your connection dropped. Try again.
Link copied
From app code
Most toasts follow something the app did, after the server answered. Dispatch canon-toast on the document with what to show: title, description, intent, action ({ label, onClick }), duration. The toast made comes back on detail.toast, which fires canon-dismiss when it goes (detail.reason). A toast with an action stays 10 seconds.
Delete it, then undo, or let the toast go.
Edge cases
Right to left, the toaster sits at the bottom-left and the icon comes first on the right. Long text wraps. At most three toasts at once: a fourth sends the oldest away.
تم حفظ الفاتورة
الفاتورة INV-2041 محدثة.
Some invoices weren't sent because their customers have no billing email on file
Add an email to Globex Corporation, Initech and Umbrella, then send them again from the list.