Skip to main content

Showing a toast

A toast is a brief, non-blocking message that slides in, lingers, and slides out: the right tool for “Copied!” or “Settings saved” feedback. showToast displays one and returns a handle for controlling it. If you don’t pass an id, one is generated for you.
import { toasts } from '@unbound-app/api';

toasts.showToast({ content: 'Copied to clipboard' });

Toast handles

The returned handle is your reference to the toast after it’s shown. Use it to dismiss the toast early instead of waiting for it to time out.
import { toasts } from '@unbound-app/api';

const toast = toasts.showToast({ content: 'Uploading...' });

// later, once the work finishes:
toast.close();
Pass a stable id when a toast should replace a previous one rather than stack, handy for progress updates that shouldn’t pile up on screen.