Skip to content

toast

const toast: object

Defined in: src/core/toast.ts:173

Imperative toast API. Each level helper returns the new toast’s id.

toast.info("Saved");
toast.error("Upload failed", { duration: 0 }); // sticky
const id = toast.warn("Reconnecting…");
toast.dismiss(id);

clear: () => void

Dismiss all toasts.

void

dismiss: (id) => void

Dismiss a toast by id.

number

void

error: (message, opts?) => number

Error toast (sticky by default).

string

Omit<ToastOptions, "message" | "level">

number

generic: (message, opts?) => number

Neutral toast.

string

Omit<ToastOptions, "message" | "level">

number

info: (message, opts?) => number

Info toast.

string

Omit<ToastOptions, "message" | "level">

number

show: (opts) => number

Raise a toast from full options; returns its id.

ToastOptions

number

success: (message, opts?) => number

Success toast.

string

Omit<ToastOptions, "message" | "level">

number

warn: (message, opts?) => number

Warning toast.

string

Omit<ToastOptions, "message" | "level">

number