menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ToastPosition - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ToastPosition

    Configures to display a toast in the custom position within the document or target.

    Inheritance
    System.Object
    ToastPosition
    Namespace: Syncfusion.Blazor.Notifications
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class ToastPosition : OwningComponentBase
    Remarks

    The ToastPosition component allows you to specify the exact positioning of toast notifications within their target container. It provides control over both horizontal (X) and vertical (Y) positioning to ensure toast messages appear exactly where needed.

    Examples

    A simple ToastPosition configuration.

    <SfToast>
        <ToastPosition X="Center" Y="Bottom" />
    </SfToast>

    Constructors

    ToastPosition()

    Declaration
    public ToastPosition()

    Properties

    X

    Gets or sets the position of the Toast notification with respect to the target container's left edge.

    Declaration
    public string X { get; set; }
    Property Value
    Type Description
    System.String

    A string representing the horizontal position of the toast. The default value is "Left".

    Remarks

    This property determines the horizontal positioning of the toast notification within its target container. Common values include "Left", "Center", "Right", or custom pixel/percentage values like "100px" or "50%". The positioning is relative to the left edge of the target container.

    Y

    Gets or sets the position of the Toast notification with respect to the target container's top edge.

    Declaration
    public string Y { get; set; }
    Property Value
    Type Description
    System.String

    A string representing the vertical position of the toast. The default value is "Top".

    Remarks

    This property determines the vertical positioning of the toast notification within its target container. Common values include "Top", "Center", "Bottom", or custom pixel/percentage values like "100px" or "50%". The positioning is relative to the top edge of the target container.

    Methods

    Dispose()

    Releases all resources used by the ToastPosition component.

    Declaration
    public virtual void Dispose()
    Remarks

    This method provides a way to release resources and perform cleanup operations when the ToastPosition component is no longer needed. It calls the protected Dispose(Boolean) method with true to indicate that both managed and unmanaged resources should be disposed.

    Dispose(Boolean)

    Releases the unmanaged resources used by the ToastPosition component and optionally releases the managed resources.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    A bool value indicating whether to dispose both managed and unmanaged resources (true) or only unmanaged resources (false).

    Remarks

    This method is called by the public Dispose() method and the finalizer. When disposing is true, this method releases all resources held by managed objects that this ToastPosition references, including clearing the parent reference.

    OnParametersSetAsync()

    Method invoked when the component has received parameters from its parent.

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing any asynchronous operation.

    Remarks

    This method is called whenever the component's parameters are updated from its parent component. It ensures that the parent SfToast component is notified of position changes so it can update the toast's display position accordingly.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved