Class ToastAnimationSettings
Specifies the show and hide animation settings for the SfToast component.
Inheritance
Namespace: Syncfusion.Blazor.Notifications
Assembly: Syncfusion.Blazor.dll
Syntax
public class ToastAnimationSettings : OwningComponentBase
Remarks
The ToastAnimationSettings class allows you to configure custom animations for both showing and hiding toast notifications. You can specify different animation effects, durations, and easing functions to enhance the user experience when toasts appear or disappear. This component provides a declarative way to define animation behaviors through the ShowSettings and HideSettings properties.
Examples
Basic usage of ToastAnimationSettings in a Toast component:
<SfToast>
<ToastAnimationSettings>
<ToastShowAnimationSettings Effect="ToastAnimationEffect.FadeIn" Duration="600" />
<ToastHideAnimationSettings Effect="ToastAnimationEffect.FadeOut" Duration="400" />
</ToastAnimationSettings>
</SfToast>
Constructors
ToastAnimationSettings()
Declaration
public ToastAnimationSettings()
Properties
HideSettings
Gets or sets the animation settings applied when hiding the toast notification.
Declaration
public ToastHideAnimationSettings HideSettings { get; set; }
Property Value
Type | Description |
---|---|
ToastHideAnimationSettings | A ToastHideAnimationSettings instance that defines the animation properties for hiding the toast. |
Remarks
The HideSettings property allows you to customize how the toast disappears from view. You can configure properties such as animation effect, duration, delay, and easing to create smooth hide transitions. If not specified, default hide animation settings will be applied automatically. Common hide effects include FadeOut, SlideUp, SlideLeft, SlideRight, and ZoomOut animations.
Examples
Setting custom hide animation settings:
<ToastAnimationSettings>
<ToastHideAnimationSettings Effect="ToastAnimationEffect.SlideUp" Duration="500" />
</ToastAnimationSettings>
ShowSettings
Gets or sets the animation settings applied when showing the toast notification.
Declaration
public ToastShowAnimationSettings ShowSettings { get; set; }
Property Value
Type | Description |
---|---|
ToastShowAnimationSettings | A ToastShowAnimationSettings instance that defines the animation properties for showing the toast. |
Remarks
The ShowSettings property allows you to customize how the toast appears on screen. You can configure properties such as animation effect, duration, delay, and easing to create engaging show transitions. If not specified, default show animation settings will be applied automatically. Common show effects include FadeIn, SlideDown, SlideLeft, SlideRight, and ZoomIn animations. The show animation plays immediately when the toast is triggered to appear.
Examples
Setting custom show animation settings:
<ToastAnimationSettings>
<ToastShowAnimationSettings Effect="ToastAnimationEffect.SlideDown" Duration="600" />
</ToastAnimationSettings>
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
Dispose()
Releases all resources used by the ToastAnimationSettings component.
Declaration
public virtual void Dispose()
Remarks
This method implements the System.IDisposable pattern and should be called when the component is no longer needed.
It ensures proper cleanup of managed and unmanaged resources, preventing memory leaks.
The method calls the protected Dispose(Boolean) method with true
to indicate that managed resources should be disposed.
Dispose(Boolean)
Releases the unmanaged resources used by the ToastAnimationSettings component and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
|
Remarks
This method is called by the public Dispose() method and the finalizer.
When disposing
is true
, this method releases all managed resources including:
- Syncfusion.Blazor.Notifications.ToastAnimationSettings.ChildContent render fragment
- Syncfusion.Blazor.Notifications.ToastAnimationSettings.Parent cascading parameter reference
OnInitializedAsync()
Method invoked when the component is ready to start, after receiving its initial set of parameters from its parent in the render tree.
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous initialization operation. |
Remarks
This method is called once during the component lifecycle and is used to initialize the default animation settings. It ensures that both ShowSettings and HideSettings are properly configured with default values if they haven't been explicitly set through parameters or child components.
OnParametersSetAsync()
Method invoked when the component has received parameters from its parent component and the incoming values have been assigned to properties.
Declaration
protected override Task OnParametersSetAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous parameter processing operation. |
Remarks
This method is called every time the component receives new parameter values from its parent. It notifies the parent SfToast component about animation setting changes so that the toast can update its animation configuration accordingly. This ensures that animation changes are properly synchronized between child animation settings and the parent toast component.