Toast
Short, temporary acknowledgment of a user action. useToasts mounts a Toaster on the first call.
Default
message is the neutral type. Pass a string or an object with a text field.
Types
Pick the method from how the user experienced the event, not from the HTTP status.
Preview
Toast renders one item. useToasts pushes into a shared list and mounts Toaster if the page has none.
1
<Toast :toast="{ id: 1, type: 'success', text: 'Project archived' }" />
Multi-line
Preserve
preserve skips the auto-dismiss timer. Use it only when the user must read or act before it disappears.
Action
action is the button label. onAction runs, then the toast dismisses. Action toasts stay up for 8 seconds.
Undo
onUndoAction paints a button labeled Undo. Only use it when rollback is safe.
Rich text
text can be a string or a VNode. Keep it to one short phrase — toasts are not a document.
Best practices
- Non-blocking confirmations of something the user just did:
Domain added,Project archived. - Field validation stays on the input. Persistent warnings stay in Note or Banner. Billing or build failures need a durable row plus a short toast.
- Pick the method from the user's experience. A canceled deploy is
message, notsuccess. A partial deploy iswarning. - Default toasts auto-dismiss (4s, 6s for error, 8s with an action).
preserveonly when the user must act. - One toast at the end of an async flow. Do not narrate every hop.
- Completion copy is a noun plus a past participle:
Blob deleted. Never "successfully". Skip the period on a single sentence. - Error toasts are two sentences with periods and a recovery step:
Couldn't verify domain. Try again. - Match the toast verb to the button: Delete Project then
Project deleted, never "removed". - The undo label is the word
Undo. Only offer it when rollback is safe. - Do not put primary navigation in a toast. The surface disappears before keyboard users can reach it.