Class SfToast
Toast is a small, nonblocking notification pop-up and it is shown to users with readable message content at the bottom of the screen or at a specific target and disappears automatically after a few seconds (time-out) with different animation effects.
Inherited Members
Namespace: Syncfusion.Blazor.Notifications
Assembly: Syncfusion.Blazor.dll
Syntax
public class SfToast : SfBaseComponent
Constructors
SfToast()
Declaration
public SfToast()
Properties
ChildContent
Sets the content of the Toast.
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.RenderFragment |
Content
Specifies the content to be displayed on the Toast. Accepts selectors, string values and HTML elements.
Declaration
public string Content { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. |
ContentTemplate
Specifies the HTML element/element ID as a string that can be displayed as a Toast content.
Declaration
public RenderFragment ContentTemplate { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.RenderFragment |
CssClass
Defines single/multiple classes (separated by space) to be used for customization of Toast.
Declaration
public string CssClass { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts a CSS class string separated by space to customize the appearance of Toast component. |
EnableRtl
Enable or disable rendering component in right to left direction.
Declaration
public bool EnableRtl { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
ExtendedTimeout
Specifies the Toast display time duration after interacting with the Toast.
Declaration
public int ExtendedTimeout { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | Accepts an integer value. The default value is |
Height
Specifies the height of the Toast in pixels/number/percentage. Number value is considered as pixels.
Declaration
public string Height { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. The default value is |
Icon
Defines CSS classes to specify an icon for the Toast which is to be displayed at top left corner of the Toast.
Declaration
public string Icon { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. |
ID
Specifies the unique identifier.
Declaration
public string ID { get; set; }
Property Value
Type |
---|
System.String |
NewestOnTop
Specifies the newly created Toast message display order while multiple toast's are added to page one after another. By default, newly added Toast will be added after old Toast's.
Declaration
public bool NewestOnTop { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
ProgressDirection
Specifies the direction for the Toast progressBar.
Declaration
public ProgressDirection ProgressDirection { get; set; }
Property Value
Type |
---|
ProgressDirection |
ShowCloseButton
Specifies whether to show the close button in Toast message to close the Toast.
Declaration
public bool ShowCloseButton { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
ShowProgressBar
Specifies whether to show the progress bar to denote the Toast message display timeout.
Declaration
public bool ShowProgressBar { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Target
Specifies the target container where the Toast to be displayed.
Based on the target, the positions such as Left
, Top
will be applied to the Toast.
The default value is null, which refers the document.body
element.
Declaration
public string Target { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. |
Timeout
Specifies the Toast display time duration on the page in milliseconds.
- Once the time expires, Toast message will be removed.
- Setting 0 as a time out value displays the Toast on the page until the user closes it manually.
Declaration
public int Timeout { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | Accepts an integer value. The default value is |
Title
Specifies the title to be displayed on the Toast. Works only with string values.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. |
Width
Specifies the width of the Toast in pixels/numbers/percentage. Number value is considered as pixels.
In mobile devices, default width is considered as 100%
.
Declaration
public string Width { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. The default value is |
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
OnAfterRenderAsync(Boolean)
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | firstRender |
Returns
Type |
---|
System.Threading.Tasks.Task |
Overrides
OnInitializedAsync()
Method invoked when the component is ready to start.
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing any asynchronous operation. |
Overrides
ShowAsync(ToastModel)
To show Toast element on a document with the relative position.
Declaration
public Task ShowAsync(ToastModel toastModel = null)
Parameters
Type | Name | Description |
---|---|---|
ToastModel | toastModel | Specifies the ToastModel to show Toast element on screen. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing any asynchronous operation. |