Toaster configuration
Toaster options can be modified globally on the client side. The configured values apply to all toasts displayed afterward. Without explicit configuration, Lagoon uses the default values of LgToastrOptions.
Global configuration
In the Client project, configure the options in Main.cs, via OnConfigureBehavior.
Main.cs
public class Main : LgCustomApplication
{
protected override void OnConfigureBehavior(ApplicationBehavior app)
{
// Applies a common position and duration to all toasts.
app.Toastr.Position = Position.TopRight;
app.Toastr.ProgressBar = false;
app.Toastr.TimeOut = 5000;
}
}
Available options
| Option | Type | Default | Description |
|---|---|---|---|
CloseButton | bool | true | Shows a close button. |
Debug | bool | false | Enables debug mode for the toast library. |
NewestOnTop | bool | false | Displays new messages above previous ones if the value is true. |
ProgressBar | bool | true | Shows a progress bar indicating the remaining display duration. |
PreventDuplicates | bool | false | Prevents displaying two messages with the same content simultaneously. |
Position | Position | Position.TopRight | Defines the position of toasts. |
PositionClass | string | Computed | CSS class computed from Position. |
Onclick | string | null | JavaScript callback called when clicking on a toast. |
ShowDuration | int | 300 | Duration of the show animation, in milliseconds. |
HideDuration | int | 1000 | Duration of the hide animation, in milliseconds. |
TimeOut | int | 5000 | Delay before auto-closing non-error messages. |
ExtendedTimeOut | int | 1000 | Delay before closing after hover. |
ShowEasing | string | "swing" | CSS easing function for the show animation. |
HideEasing | string | "linear" | CSS easing function for the hide animation. |
ShowMethod | string | "fadeIn" | Animation used for showing. |
HideMethod | string | "fadeOut" | Animation used for hiding. |
Available positions
| Value | Computed CSS class |
|---|---|
Position.TopLeft | toast-top-left |
Position.TopRight | toast-top-right |
Position.BottomLeft | toast-bottom-left |
Position.BottomRight | toast-bottom-right |
Position.TopCenter | toast-top-center |
Position.BottomCenter | toast-bottom-center |
info
These options are global behavior parameters. Toasts are displayed from a page or component using methods inherited from LgComponentBase, for example ShowSuccess("#OrderSaved").