Toasts
Index
Interfaces
Type Aliases
Interfaces
Options
optionalbuttons
Optional array of action buttons to render inside the toast.
optionalduration
How long (in milliseconds) the toast remains visible.
optionalicon
Optional icon to display alongside the message.
optionaliconColor
Optional icon color.
message
Text content of the toast.
optionalonClick
Callback when the toast is clicked.
Type declaration
Parameters
ev: MouseEvent
toast: ToastElement
Returns void
optionalonClose
Callback when the toast is closed, with a reason.
Type declaration
Parameters
toast: ToastElement
reason: CloseReason
Returns void
optionalonShow
optionalprogress
Whether to show a progress bar.
optionalstopProgressOnHover
Whether to stop the progress bar animation when the mouse hovers over the toast.
optionaltitle
Title of the toast.
optionaltype
Type and style of the toast.
ToastButton
Defines a button to be rendered inside a toast notification.
- label:
- onClick:
label
Text displayed on the button.
onClick
Handler invoked when the button is clicked.
The this
context is bound to the actual HTMLButtonElement created for this toast.
Type declaration
Parameters
this: HTMLButtonElement
ev: MouseEvent
toast: ToastElement
Returns void
ToastElement
Represents the DOM element for a rendered toast.
Extends HTMLDivElement and may include an internal _dismiss
method
that can be programmatically called to close the toast with a given reason.
optional_dismiss
Type declaration
Parameters
reason: CloseReason
Returns void
removeAttribute
Parameters
qualifiedName: string
Returns void
setAttribute
Parameters
qualifiedName: string
value: any
Returns void
Type Aliases
CloseReason
Describes why a toast was closed. Includes predefined reasons like 'timeout', 'manual', 'click', 'external', and allows for custom string-based reasons. Used in the Toasts.Options.onClose callback.
IconColor
Describes the color of an icon. Might help when default icons looks like shit. 'accent' is the same as the accent color of the toast, e.g. text.
Type
Defines the type and style of a toast notification. Includes standard types like 'info', 'success', 'warning', 'error', and allows for custom string-based types.
Configuration options for displaying a toast notification.