diff --git a/BlazorFluentUI/Components/Pages/Components/CompoToast.razor b/BlazorFluentUI/Components/Pages/Components/CompoToast.razor
index 8fb307b..28b1fc8 100644
--- a/BlazorFluentUI/Components/Pages/Components/CompoToast.razor
+++ b/BlazorFluentUI/Components/Pages/Components/CompoToast.razor
@@ -19,6 +19,65 @@
Open
+
Toast with options
+
+
+ Click ont this button to open a Toast with option.
+ The toast is created by specifting an intent, message, action and a random timout between 2 and 5 seconds.
+
+ Open
+
+ Message: @woMessage?.ToString()
+
+
+
+Confirmation Toasts
+
+
+ @foreach (var intent in toastIntentArray)
+ {
+
+ @intent.ToString() Toast
+
+ }
+
+
+
+Communication Toasts
+
+
+ Show Communication Toast
+
+
+ Message: @coMessage?.ToString()
+
+
+
+Progress Toasts
+
+
+
+ Show Toast
+
+
+ Update
+
+
+ Reset
+
+
+ Close
+
+
+ Show Indeterminate Toast
+
+
+
+ Message: @pMessage?.ToString()
+
+
+
@code {
int dcounter = 1;
void ShowDToast()
@@ -27,4 +86,126 @@
var message = $"Simple Toast #{dcounter++}";
ToastService.ShowToast(intent, message);
}
+
+ int woCouner = 1;
+ string? woMessage;
+ void ShowWOToast()
+ {
+ var intent = Enum.GetValues()[Random.Shared.Next(10)];
+ int timeout = Random.Shared.Next(2000, 5000);
+ var message = $"Simple Toast with options #{dcounter++} (Timeout: {timeout}ms)";
+
+ ToastService.ShowToast(
+ intent,
+ message,
+ timeout,
+ "Action",
+ EventCallback.Factory.Create(this, (e) => woMessage = $"Toast with options clicked!")
+ );
+ }
+
+ static ToastIntent[] toastIntentArray = Enum.GetValues();
+
+ string? coMessage;
+ void ShowCoToast()
+ {
+ ToastService.ShowCommunicationToast(new ToastParameters()
+ {
+ Intent = ToastIntent.Success,
+ Title = "This is communication toast",
+ Timeout = 4000,
+ PrimaryAction = "Primary Action",
+ OnPrimaryAction = EventCallback.Factory.Create(this, (e) => coMessage = "PrimaryAction clicked"),
+ SecondaryAction = "Secondary Action",
+ OnSecondaryAction = EventCallback.Factory.Create(this, (e) => coMessage = "SecondaryAction clicked"),
+ Content = new CommunicationToastContent()
+ {
+ Subtitle = "A communication toast subtitle",
+ Details = "A communication toast details. This toast can help you give more information."
+ }
+ });
+ }
+
+ FluentButton? pUpdateButton;
+ static string pId = "progressToast";
+ CancellationTokenSource pCancel = new CancellationTokenSource();
+ ToastParameters pToastData;
+ ToastParameters pToastDataIndeterminate;
+ string? pMessage;
+
+ protected override void OnInitialized()
+ {
+ pToastData = new ToastParameters()
+ {
+ Id = pId,
+ Intent = ToastIntent.Progress,
+ Title = "Processing data",
+ Timeout = 0,
+ TopAction = "Cancel",
+ OnTopAction = EventCallback.Factory.Create(this, (e) => pMessage = "Cancel clicked"),
+ Content = new ProgressToastContent()
+ {
+ Details = "This may take a while.",
+ Progress = 0,
+ }
+ };
+
+ pToastDataIndeterminate = new ToastParameters()
+ {
+ Id = $"{pId}Indeterminate",
+ Intent = ToastIntent.Progress,
+ Title = "Processing data",
+ Timeout = 5000,
+ TopAction = "Cancel",
+ OnTopAction = EventCallback.Factory.Create(this, (e) => pMessage = "Cancel clicked"),
+ Content = new ProgressToastContent()
+ {
+ Details = "This will close after the 7000ms",
+ }
+ };
+ }
+
+ protected override void OnAfterRender(bool firstRender)
+ {
+ if (firstRender)
+ pUpdateButton.SetDisabled(true);
+ }
+
+ void ShowPToast()
+ {
+ pUpdateButton.SetDisabled(false);
+ ToastService.ShowProgressToast(pToastData);
+ }
+
+ void ShowPIndeterminateToast()
+ {
+ ToastService.ShowProgressToast(pToastDataIndeterminate);
+ }
+
+ async Task UpdateProgress()
+ {
+ pUpdateButton.SetDisabled(true);
+ for (int i = 0; i < 101; i++)
+ {
+ pToastData.Content.Progress = i;
+ ToastService.UpdateToast(pId, pToastData);
+ await Task.Delay(100, pCancel.Token);
+ }
+ }
+
+ void Reset()
+ {
+ pCancel.Cancel();
+ pToastData.Content.Progress = 0;
+ ToastService.UpdateToast(pId, pToastData);
+ pCancel = new CancellationTokenSource();
+ pUpdateButton.SetDisabled(false);
+ }
+
+ void Close()
+ {
+ Reset();
+ ToastService.CloseToast(pId);
+ pUpdateButton.SetDisabled(true);
+ }
}