Loading...
Loading...
Implement Syncfusion Blazor notification components (Toast, Message, Skeleton) for user feedback and loading states. ALWAYS use this when users need toast notifications, popup messages, alert boxes, success/error/warning/info messages, loading skeletons, shimmer effects, content placeholders, or any feedback UI. Trigger immediately when users mention notifications, toasts, alerts, messages, loading states, skeleton screens, shimmer loading, user feedback, status messages, SfToast, SfMessage, SfSkeleton, notification popups, or need to show temporary messages, form validation feedback, or loading placeholders.
npx skill4agent add syncfusion/blazor-ui-components-skills syncfusion-blazor-notifications@page "/toast-demo"
@using Syncfusion.Blazor.Notifications
@using Syncfusion.Blazor.Buttons
<SfButton @onclick="ShowToast">Show Toast</SfButton>
<SfToast @ref="ToastObj" Title="Notification" Content="Your changes have been saved successfully!" />
@code {
SfToast ToastObj;
private async Task ShowToast()
{
await ToastObj.ShowAsync();
}
}@page "/message-demo"
@using Syncfusion.Blazor.Notifications
<SfMessage Severity="MessageSeverity.Success" ShowIcon="true" ShowCloseIcon="true">
Your profile has been updated successfully!
</SfMessage>
<SfMessage Severity="MessageSeverity.Warning" ShowIcon="true">
Your session will expire in 5 minutes.
</SfMessage>
<SfMessage Severity="MessageSeverity.Error" ShowIcon="true" ShowCloseIcon="true">
Failed to save changes. Please try again.
</SfMessage>@page "/skeleton-demo"
@using Syncfusion.Blazor.Notifications
<div class="skeleton-container">
<SfSkeleton Shape="SkeletonType.Circle" Width="60px" Height="60px" />
<div class="skeleton-text">
<SfSkeleton Shape="SkeletonType.Text" Width="80%" />
<SfSkeleton Shape="SkeletonType.Text" Width="60%" />
</div>
</div>
<style>
.skeleton-container {
display: flex;
gap: 16px;
padding: 16px;
}
.skeleton-text {
flex: 1;
display: flex;
flex-direction: column;
gap: 8px;
}
</style>@code {
SfToast ToastObj;
private async Task SaveData()
{
try
{
await DataService.SaveAsync();
ToastObj.Title = "Success";
ToastObj.Content = "Data saved successfully!";
await ToastObj.ShowAsync();
}
catch (Exception ex)
{
ToastObj.Title = "Error";
ToastObj.Content = $"Failed to save: {ex.Message}";
await ToastObj.ShowAsync();
}
}
}<EditForm Model="@model" OnValidSubmit="HandleValidSubmit">
<DataAnnotationsValidator />
@if (!string.IsNullOrEmpty(errorMessage))
{
<SfMessage Severity="MessageSeverity.Error"
ShowIcon="true"
ShowCloseIcon="true"
Closed="@(() => errorMessage = null)">
@errorMessage
</SfMessage>
}
<!-- Form fields -->
</EditForm>@if (isLoading)
{
<div class="product-card-skeleton">
<SfSkeleton Shape="SkeletonType.Rectangle" Width="100%" Height="200px" />
<SfSkeleton Shape="SkeletonType.Text" Width="80%" />
<SfSkeleton Shape="SkeletonType.Text" Width="60%" />
</div>
}
else
{
<div class="product-card">
<img src="@product.ImageUrl" alt="@product.Name" />
<h3>@product.Name</h3>
<p>@product.Description</p>
</div>
}<SfToast @ref="SuccessToast"
Title="Success"
Icon="e-success"
CssClass="e-toast-success"
<ToastPosition X="Right" Y="Top"></ToastPositio
<SfToast @ref="ErrorToast"
Title="Error"
Icon="e-error"
CssClass="e-toast-danger"
<ToastPosition X="Right" Y="Top"></ToastPosition>
<SfToast @ref="WarningToast"
Title="Warning"
Icon="e-warning"
CssClass="e-toast-warning"
<ToastPosition X="Right" Y="Top"></ToastPosition>
@code {
SfToast SuccessToast, ErrorToast, WarningToast;
private async Task ShowSuccess(string message)
{
SuccessToast.Content = message;
await SuccessToast.ShowAsync();
}
private async Task ShowError(string message)
{
ErrorToast.Content = message;
await ErrorToast.ShowAsync();
}
private async Task ShowWarning(string message)
{
WarningToast.Content = message;
await WarningToast.ShowAsync();
}
}dotnet add package Syncfusion.Blazor.Notifications
dotnet add package Syncfusion.Blazor.Themesusing Syncfusion.Blazor;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSyncfusionBlazor();@using Syncfusion.Blazor.Notifications<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js"></script>| Property | Type | Description |
|---|---|---|
| Content | string | Toast message content |
| Title | string | Toast title text |
| Icon | string | Icon CSS class |
| Position | ToastPosition | X and Y position (Top, Bottom, Left, Right, Center) |
| Timeout | int | Auto-hide duration in milliseconds (default: 5000) |
| ShowCloseButton | bool | Display close button (default: false) |
| ShowProgressBar | bool | Display progress bar (default: false) |
| NewestOnTop | bool | Stack newest toast on top (default: true) |
| CssClass | string | Custom CSS classes |
| Property | Type | Description |
|---|---|---|
| Severity | MessageSeverity | Normal, Info, Success, Warning, Error |
| Variant | MessageVariant | Text, Outlined, Filled |
| ShowIcon | bool | Display severity icon (default: true) |
| ShowCloseIcon | bool | Display close button (default: false) |
| Visible | bool | Control visibility |
| ContentAlignment | HorizontalAlign | Left, Center, Right alignment |
| CssClass | string | Custom CSS classes |
| Property | Type | Description |
|---|---|---|
| Shape | SkeletonType | Circle, Square, Rectangle, Text |
| Effect | ShimmerEffect | Pulse, Wave, Fade, None |
| Width | string | Width in px, %, or other CSS units |
| Height | string | Height in px, %, or other CSS units |
| Visible | bool | Control visibility |
| Label | string | Accessibility label |
| CssClass | string | Custom CSS classes |
ShowAsync()VisibletrueEffectVisibletruebuilder.Services.AddSyncfusionBlazor()