How It Works
When you create a toast, it returns an ID:Basic Pattern
Practical Examples
Loading to Success
Multi-Step Process
Update the same toast through multiple steps:File Upload with Progress
API Request with Retry
Updating with Different Options
You can change any toast option when updating:Custom ID
You can also provide your own custom ID:Preventing Duplicate Toasts
Use a consistent ID to prevent creating duplicate toasts:Complete Example
Here’s a full example combining multiple concepts:Best Practices
- Always save the toast ID when you plan to update it later
- Use descriptive messages at each update stage
- Handle both success and error cases to ensure the toast always resolves
- Consider using
toast.promise()instead if you’re working with a single Promise (see Promise Toasts) - Clean up by ensuring loading toasts are always updated or dismissed