Updating & Programmatic Dismissal
Dynamically patch active toasts in place, close them programmatically, or inspect active history.
toastory allows mutating any active toast by its unique string or numeric ID without causing DOM unmounts or jittery reflows.
Updating Toasts In Place
// 1. Launch a persistent loading toast const toastId = toast.loading('Uploading assets...', { duration: 0 });
// 2. Later, patch it with new progress and text toast.update(toastId, { title: 'Optimizing media...', description: 'Processed 8 of 10 files.', });
// 3. Complete the toast as a success notification
toast.update(toastId, {
type: 'success',
title: 'Upload complete!',
description: '10 files synced to S3.',
duration: 4000,
});
`
Dismissal & History
// Dismiss specific toast by ID:// Dismiss all currently visible toasts at once: toast.dismissAll();
// Retrieve all active toasts: const active = toast.getToasts();
// Retrieve last 100 dismissed items:
const history = toast.getHistory();
`
Want to test these options live?
Launch the interactive playground to experiment with themes, positions, and live generators.