Display & Navigation · Toaststable
Toast
A short, temporary message about the result of an action, in five intents with an optional action and close button.
Preview
#previewSwitch intent, description, action and close. The card is shown inline; in an app useToast() places it in the corner.
Payout sent
Your payout of $1,240.00 is on its way.
positive · yes · yes · yes
toast-example.tsx
import { useToast } from "@blade-ai/weft/components/toast";
export function usePayoutToast() {
const { toast } = useToast();
return () =>
toast({
title: "Payout sent",
description: "Your payout of $1,240.00 is on its way.",
intent: "positive",
action: { label: "View payout", onClick: openPayout },
});
}All states
#all-statesEvery intent with description, action and close, and the title-only form.
Payout sent
Your payout of $1,240.00 is on its way.
Neutral
Payout sent
Your payout of $1,240.00 is on its way.
Positive
Payout failed
Your bank rejected the transfer.
Negative
Payout sent
Your payout of $1,240.00 is on its way.
Notice
Payout sent
Your payout of $1,240.00 is on its way.
Information
Link copied
Title only
New version available
Reload to get the latest changes.
Description, no action
Saved
Changes saved to draft.
No close button
Props
#propsToast is the card; Toaster and useToast show it in a corner stack.
Toast
Prop
Type
Default
Description
title
string
—
Bold first line. Required.
description
ReactNode
—
Supporting sentence.
intent
"neutral" | "positive" | "negative" | "notice" | "information"
"neutral"
Sets the icon colour and the live-region politeness.
action
{ label: string; onClick: () => void }
—
One secondary action, for example Retry or View payout.
onClose
() => void
—
Shows the close button when set.
closeLabel
string
"Dismiss"
Accessible name of the close button.
className
string
—
Extra classes on the card.
Toaster
Prop
Type
Default
Description
children
ReactNode
—
Your app. Wrap it once.
position
"bottom-right" | "bottom-left" | "top-right" | "top-left"
"bottom-right"
Stack corner.
limit
number
5
Most toasts shown at once; the oldest is dropped first.
useToast
Prop
Type
Default
Description
toast
(options: ToastOptions) => number
—
Shows a toast and returns its id. Options are the Toast props plus duration.
duration
number
5000
Auto-dismiss in ms. 0 keeps it until closed. Negative toasts default to 0.
dismiss
(id?: number) => void
—
Removes one toast, or all when no id is given.
Usage
#usageShort rules for choosing and writing toasts.
Do
Confirm what just happened in one line.
Use negative only for failures and give a way forward.
Offer at most one action, such as Retry.
Keep the title under about six words.
Don't
Do not use a toast for something people must act on; use an Alert or Modal.
Do not stack more than a few at once.
Do not put long text or several actions inside.
Do not rely on the icon colour alone to carry the meaning.
Accessibility
#accessibilityLive regions: negative toasts are announced assertively, the rest politely.
Keyboard
Key
Action
Tab
Moves focus to the action and close button; focus pauses the timer.
Enter / Space
Activates the focused action or close button.
Esc
Dismisses the toast that holds focus.
ARIA
Element
Role / attribute
When
Toast
role="status"
All intents except negative. Announced politely.
Toast
role="alert"
Negative intent. Announced assertively.
Toaster
role="region" · aria-label="Notifications"
Always.
Close button
aria-label
Always. Defaults to "Dismiss".
Icon
aria-hidden
Always. Decorative.