Fractal UI Motif Fractal UI Type
On this Page

ToastOptions

ToastOptions configures one notification created with toast. It is a TypeScript interface, not a rendered component.

Usage

TypeScript
import { toast, type ToastOptions } from "fractalsvelte";

const options: ToastOptions = {
	description: "Your profile is now public.",
	duration: 4000,
	tone: "success",
};

toast("Profile updated", options);

Pass the options object as the second argument to toast, or to a semantic helper such as toast.success.

API

FieldTypeDefaultDescription
descriptionstringundefinedOptional supporting detail displayed below the toast message.
durationnumber5000Auto-dismiss delay in milliseconds. Use 0 to keep the toast open until it is dismissed.
toneToastTone'neutral'Visual and semantic emphasis for the notification.

The toast(message, options?) function returns the numeric toast id. Pass that id to toast.dismiss(id) to remove one notification, or call toast.dismiss() to clear the queue.

Use ToastTone to constrain the tone field, and mount Toaster once near the application root to display the queue.