Live example

    Usage
    const { toast } = useToast();
    toast({ title: 'Booking saved', tone: 'success', action: { label: 'Undo', onClick: undo } });

    Props

    Toast props
    PropTypeDefaultDescription
    titlestringnoneShort message.
    description?stringnoneOptional detail.
    tone?'neutral' | 'success' | 'danger''neutral'danger is announced assertively.
    duration?number6000Auto-dismiss in ms, paused on hover and focus. 0 keeps it.
    action?{ label: string; onClick: () => void }noneOne optional action, such as Undo.

    Do and don't

    Do

    • Confirm actions that changed data.
    • Offer Undo instead of a confirmation dialog for reversible actions.

    Don't

    • Put the only copy of important information in a toast.
    • Stack many toasts; the provider keeps at most three.

    Accessibility

    • Messages are announced through live regions that exist from page load, which is more reliable than inserting role status nodes.
    • Timers pause while the pointer or focus is on the toast (WCAG 2.2.1 timing adjustable).
    • Each toast has a dismiss button named after its message.

    Keyboard

    Toast keyboard support
    KeysAction
    TabReaches the toast action and dismiss buttons in the notifications region