Skip to content

Toast — API Reference

The fluix object is the primary way to create toasts. Import it from any adapter package.

MethodSignatureReturnsDescription
fluix.success()(options: FluixToastOptions) => stringToast IDShow a success toast
fluix.error()(options: FluixToastOptions) => stringToast IDShow an error toast
fluix.warning()(options: FluixToastOptions) => stringToast IDShow a warning toast
fluix.info()(options: FluixToastOptions) => stringToast IDShow an info toast
fluix.action()(options: FluixToastOptions) => stringToast IDShow a toast with action button
fluix.promise()<T>(promise: Promise<T>, options: FluixToastPromiseOptions<T>) => Promise<T>PromiseShow loading → success/error
fluix.dismiss()(id: string) => voidDismiss a specific toast
fluix.clear()(position?: FluixPosition) => voidClear all toasts, optionally by position

Options passed to fluix.success(), fluix.error(), etc.

PropertyTypeDefaultDescription
idstringauto-generatedUnique toast ID. If omitted, uses a shared ID (replaces previous toast).
titlestringToast headline text
descriptionunknownBody content. React accepts JSX, others accept strings/HTML.
positionFluixPositionToaster defaultOverride the Toaster’s default position
durationnumber | null6000Auto-dismiss delay in ms. null = persistent.
iconunknownDefault state iconCustom icon. Pass a string emoji or framework element.
theme"light" | "dark""light"Toast color theme
fillstring"#FFFFFF"CSS color for the toast background
roundnessnumber16Border radius / gooey blur factor
autopilotboolean | { expand?: number; collapse?: number }Auto expand/collapse behavior
buttonFluixToastButtonAction button configuration
stylesFluixToastStylesCSS class overrides for sub-elements
PropertyTypeDescription
titlestringButton text
onClick() => voidClick handler

CSS class overrides added to sub-elements (additive, does not replace default styles).

PropertyTypeDescription
titlestringClass for the title element
descriptionstringClass for the description element
badgestringClass for the icon badge
buttonstringClass for the action button

Options for fluix.promise().

PropertyTypeDescription
loadingPick<FluixToastOptions, "title" | "icon">Options shown during loading state
successFluixToastOptions | ((data: T) => FluixToastOptions)Options on resolve (static or callback)
errorFluixToastOptions | ((err: unknown) => FluixToastOptions)Options on reject (static or callback)
positionFluixPositionPosition for the promise toast

Configuration object for the Toaster component.

PropertyTypeDefaultDescription
positionFluixPosition"top-right"Default position for all toasts
layout"stack" | "notch""stack"Layout mode
offsetnumber | string | FluixOffsetConfigViewport offset. Number (px), string (“1rem”), or per-side object.
defaultsPartial<FluixToastOptions>Default options merged into every toast
type FluixPosition =
| "top-left"
| "top-center"
| "top-right"
| "bottom-left"
| "bottom-center"
| "bottom-right";
type FluixToastState = "success" | "loading" | "error" | "warning" | "info" | "action";