Skip to content

useToast

useToast(): UseToastReturn

Defined in: src/components/feedback/Toast/useToast.ts:28

Hook to trigger toast notifications from any component inside a <ToastProvider>.

Returns

UseToastReturn

Throws

Error if used outside of a <ToastProvider>

Example

const { toast, success, error, dismiss } = useToast();
success('File saved successfully');
error('Failed to export', { title: 'Export Error' });
const id = toast({ message: 'Custom toast', severity: 'info' });
dismiss(id);