On this Page
ToastTone
ToastTone is the union of semantic appearances available to a toast. It is a TypeScript type, not a rendered component.
Usage
TypeScript
import { toast, type ToastTone } from "fractalsvelte";
const tone: ToastTone = "warning";
toast("Storage is nearly full.", { tone });
The semantic helper methods set a tone automatically: toast.success, toast.info, toast.warning, and toast.error.
API
ToastTone accepts the following string values:
| Value | Description |
|---|---|
'neutral' | General-purpose status without stronger emphasis. |
'success' | A completed or successful action. |
'info' | Supplemental information or a neutral update. |
'warning' | A condition that needs attention but does not block the current task. |
'error' | A failed action or an issue that needs resolution. |
Use ToastTone as the type of ToastOptions.tone. The runtime toast(message, options?) function returns the numeric id of the newly created toast.
Related
See ToastOptions for the full notification configuration object, and Toaster for the component that renders queued notifications.
