menu

Blazor

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

    Show / Hide Table of Contents

    Class DialogButton

    A class used for configuring the button properties in the SfDialog component.

    Inheritance
    System.Object
    DialogButton
    Namespace: Syncfusion.Blazor.Popups
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class DialogButton : OwningComponentBase
    Examples

    In the following code example, a basic DialogButton has been rendered using the tag directive.

    @using Syncfusion.Blazor.Popups
    <SfDialog Width="500px" @bind-Visible="Visibility">
      <DialogTemplates>
        <Content>
            <p>
               Dialog content
              </p>
          </Content>
      </DialogTemplates>
      <DialogButtons>
          <DialogButton IsPrimary="true" Content="Ok" OnClick="@OnBtnClick" />
          <DialogButton Content="Cancel" OnClick="@OnBtnClick" />
     </DialogButtons>
      </SfDialog>
     @code {
      private bool Visibility { get; set; } = true;
      private void OnBtnClick()
      {
       this.Visibility = false;
      }
     }

    Constructors

    DialogButton()

    Declaration
    public DialogButton()

    Properties

    ChildContent

    Gets or sets a value that indicates the child content for the button including HTML element. If the child content is not specified, the button is rendered using the property.

    Declaration
    public RenderFragment ChildContent { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.RenderFragment

    The template content. The default value is null.

    Remarks

    The child content specified within the tag directive is either a string or HTML Element. The string content is also specified using the property.

    Content

    Gets or sets a value that indicates the content of button element.

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

    Accepts a string value. The default value is String.Empty.

    CssClass

    Gets or sets a value that indicates the CSS class string to customize the appearance of button.

    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 the button. The default value is String.Empty.

    Disabled

    Gets or sets a value that indicates whether to enable or disable the button.

    Declaration
    public bool Disabled { get; set; }
    Property Value
    Type Description
    System.Boolean

    true, if the button component is disabled. The default value is false.

    EnableRtl

    Gets or sets a value that indicates whether to enable or disable the right-to-left direction for the button.

    Declaration
    public bool EnableRtl { get; set; }
    Property Value
    Type Description
    System.Boolean

    true, if the right-to-left direction is enabled for the button. The default value is false.

    IconCss

    Gets or sets a value that indicates the CSS class string to include an icon or image for the button.

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

    Accepts a CSS class string separated by space to include an icon or image for the button. The default value is String.Empty.

    IconPosition

    Gets or sets a value that indicates how to display icons in the button.

    Declaration
    public IconPosition IconPosition { get; set; }
    Property Value
    Type Description
    IconPosition

    One of the IconPosition enumeration. The default value is Left

    Remarks

    If the IconPosition is Left, the icon will be placed left to the content of the button. If the IconPosition is Right, the icon will be placed right to the content of the button. If the IconPosition is Top, the icon will be placed above the content of the button. If the IconPosition is Bottom, the icon will be placed below the content of the button.

    IsFlat

    Gets or sets a value indicating whether to enable or disable the flat appearance of the dialog buttons.

    Declaration
    public bool IsFlat { get; set; }
    Property Value
    Type Description
    System.Boolean

    true, if the flat appearence is enabled for dialog button. The default value is true.

    IsPrimary

    Gets or sets a value that indicates whether to enable or disable the primary style for button.

    Declaration
    public bool IsPrimary { get; set; }
    Property Value
    Type Description
    System.Boolean

    true, if the primary style is enabled for button. The default value is false.

    IsToggle

    Gets or sets a value that indicates whether to enable or disable the toggle option for button.

    Declaration
    public bool IsToggle { get; set; }
    Property Value
    Type Description
    System.Boolean

    true, if the toggle option is enabled for button. The default value is false.

    OnClick

    Gets or sets an event callback that is triggered when the button is clicked.

    Declaration
    public EventCallback<MouseEventArgs> OnClick { get; set; }
    Property Value
    Type
    Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.Web.MouseEventArgs>
    Remarks

    The event is triggered for UI-based clicks only.

    Examples
     
    @using Syncfusion.Blazor.Popups
    <SfDialog Width="500px" @bind-Visible="Visibility">
      <DialogTemplates>
        <Content>
            <p>
               Dialog content
              </p>
          </Content>
      </DialogTemplates>
      <DialogButtons>
          <DialogButton IsPrimary="true" Content="Ok" OnClick="@OnBtnClick" />
     </DialogButtons>
      </SfDialog>
     @code {
      private bool Visibility { get; set; } = true;
      private void OnBtnClick()
      {
       this.Visibility = false;
      }
     }

    Type

    Gets or sets a value that indicates the type of button.

    Declaration
    public ButtonType Type { get; set; }
    Property Value
    Type Description
    ButtonType

    One of the ButtonType enumeration. The default value is Button

    Examples
     
    @using Syncfusion.Blazor.Popups
    <SfDialog Width="500px" @bind-Visible="Visibility">
      <DialogTemplates>
        <Content>
            <p>
               Dialog content
              </p>
          </Content>
      </DialogTemplates>
      <DialogButtons>
          <DialogButton Type="ButtonType.Submit" Content="Submit" OnClick="@OnBtnClick" />
     </DialogButtons>
      </SfDialog>
     @code {
      private bool Visibility { get; set; } = true;
      private void OnBtnClick()
      {
       this.Visibility = false;
      }
     }

    Methods

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder

    Dispose()

    Dispose the unmanaged resources.

    Declaration
    public virtual void Dispose()

    Dispose(Boolean)

    Dispose the unmanaged resources.

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

    Boolean value to dispose the object.

    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.

    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.

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