You can configure options globally by assigning an object to the variable "window.UseBootstrapToasterOptions"
. For example:
window.UseBootstrapToasterOptions = {
delay: 2000,
placement: 'top-left',
}
Alternatively, you can customize the options for a specific instance by passing an object directly to the toast
function.
toast
component prioritizes object options followed by global options and lastly default options
Name | Type | Default | Description |
---|---|---|---|
animation | boolean | true | Apply a CSS fade transition to the toast. |
autohide | boolean | true | Automatically hide the toast after the delay. |
delay | number | 4000 | Delay in milliseconds before hiding the toast. |
gap | number | 16 | Gap between toasts (px). |
margin | string | '1rem' | Margin of the corner. Can also be filled with a CSS variable. Example: var(--toast-margin). |
placement | string | 'top-right' | Corner position of the toast. Available values: top-right , top-left , bottom-right , bottom-left . |
classes | string | '' | Additional classes to apply to the toast element. |
header | string | '' | Additional information for the toast header section. It can be an object with properties such as icon, title, ago (time), and close button (closeBtn), or a string for the header title. |
body | string | '' | The content of the toast message to be displayed to the user. |