API Reference
Toastex exposes a simple, heavily typed API. Below are the available methods and interfaces.
Methods
Toastex.success(message: string, options?: ToastexOptions)Toastex.error(message: string, options?: ToastexOptions)Toastex.info(message: string, options?: ToastexOptions)Toastex.warning(message: string, options?: ToastexOptions)Toastex.show(options: ToastexOptions | string)Toastex.config(options: ToastexGlobalConfig)
ToastexOptions Interface
| Property | Type | Description |
|---|---|---|
title | string | Optional title for the toast. |
message | string | The main text content. |
type | ToastType | 'success' | 'error' | 'warning' | 'info' | 'default' |
theme | ToastTheme | 'light' | 'dark' |
variant | string | 'default' | 'swift' | 'chat' | 'minimal' | 'outline' | 'liquid-glass' | 'liquid-chat' |
position | ToastPosition | e.g. 'top-right', 'bottom-center' |
duration | number | Duration in seconds. Use 0 to disable auto-close. Default is 5. |
sound | boolean | Whether to play a sound effect. |
logoUrl | string | URL for a custom avatar (useful in chat variant). |
avatarUrl | string | Large avatar image URL (specifically for liquid-chat). |
appIconUrl | string | Small app icon overlaid on avatar (specifically for liquid-chat). |
subtitle | string | Secondary title text (specifically for liquid-chat). |
time | string | Timestamp text, e.g., 'now' (specifically for liquid-chat). |