menu

Blazor

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

    Show / Hide Table of Contents

    Class DialogOptions

    Provides options to configure built-in dialogs shown using ConfirmAsync(String, String, DialogOptions), AlertAsync(String, String, DialogOptions) and PromptAsync(String, String, DialogOptions) methods.

    Inheritance
    System.Object
    DialogOptions
    Namespace: Syncfusion.Blazor.Popups
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class DialogOptions : Object
    Remarks

    This class contains properties that allow customization of dialog appearance, behavior, positioning, animation, and button configurations for built-in dialog types.

    Constructors

    DialogOptions()

    Declaration
    public DialogOptions()

    Properties

    AllowDragging

    Gets or sets whether the dialog can be dragged by the end-user.

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

    true if the dialog can be dragged by the user; otherwise false. The default value is false.

    Remarks

    When AllowDragging is set to true, it allows a user to drag the dialog by selecting the header and dragging it for repositioning the dialog within the viewport.

    AnimationSettings

    Gets or sets the animation settings of the dialog component.

    Declaration
    public DialogAnimationOptions AnimationSettings { get; set; }
    Property Value
    Type Description
    DialogAnimationOptions

    A DialogAnimationOptions representing the animation configuration. The default value is null.

    Remarks

    The animation effect can be applied to open and close the dialog with configurable duration, delay, and effect type.

    CancelButtonOptions

    Gets or sets the cancel action button settings.

    Declaration
    public DialogButtonOptions CancelButtonOptions { get; set; }
    Property Value
    Type Description
    DialogButtonOptions

    A DialogButtonOptions representing the cancel button configuration. The default value is a new instance of DialogButtonOptions.

    Remarks

    This property allows customization of the cancel button's appearance and behavior, including its text content, icon, and enabled state. Note that this property is not applicable for alert dialogs.

    See Also
    PrimaryButtonOptions

    ChildContent

    Gets or sets the template content that is used as the dialog content.

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

    A Microsoft.AspNetCore.Components.RenderFragment that represents the custom template content. The default value is null.

    Remarks

    When this property is set, the custom template will be rendered instead of the default content text. This allows for rich content including other Blazor components.

    Examples

    In the code example below, the child content is configured for the prompt dialog box:

    await DialogService.PromptAsync(null, "Enter Your Details", new DialogOptions()
    {
        ChildContent = @<SfTextBox Placeholder="Enter Name"></SfTextBox>
    });

    CloseOnEscape

    Gets or sets whether the dialog can be closed by pressing the escape (ESC) key.

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

    true if the dialog can be closed by pressing the escape (ESC) key; otherwise false. The default value is true.

    Remarks

    When enabled, users can dismiss the dialog by pressing the Escape key on their keyboard, providing a convenient way to close the dialog without using the mouse.

    See Also
    ShowCloseIcon

    CssClass

    Gets or sets the CSS class name that can be appended to the root element of the utility dialog.

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

    A System.String representing the CSS class names. The default value is String.Empty.

    Remarks

    One or more custom CSS classes can be added to a utility dialog to customize its appearance. Multiple CSS classes should be separated by spaces.

    Height

    Gets or sets the height of the dialog.

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

    A System.String representing the height of the dialog. The default value is auto.

    Remarks

    The height can be specified in pixels (e.g., "400px"), percentage (e.g., "50%"), or as auto to let the dialog size itself based on content.

    See Also
    Width

    Position

    Gets or sets the position where the utility dialog can be positioned within the document or target.

    Declaration
    public PositionDataModel Position { get; set; }
    Property Value
    Type Description
    PositionDataModel

    A PositionDataModel representing the position configuration. The default value centers the dialog.

    Remarks

    The position can be represented with pre-configured positions or specific X and Y values. PositionDataModel.X can be configured with left, center, right, or offset value. PositionDataModel.Y can be configured with top, center, bottom, or offset value.

    PrimaryButtonOptions

    Gets or sets the primary (OK) action button settings.

    Declaration
    public DialogButtonOptions PrimaryButtonOptions { get; set; }
    Property Value
    Type Description
    DialogButtonOptions

    A DialogButtonOptions representing the primary button configuration. The default value is a new instance of DialogButtonOptions.

    Remarks

    This property allows customization of the primary button's appearance and behavior, including its text content, icon, and enabled state.

    See Also
    CancelButtonOptions

    ShowCloseIcon

    Gets or sets whether to show the close icon in the title of the dialog.

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

    true if the close icon is displayed in the dialog title section; otherwise false. The default value is false.

    Remarks

    When enabled, a close button (X) will be displayed in the dialog header, allowing users to close the dialog by clicking on it.

    See Also
    CloseOnEscape

    Width

    Gets or sets the width of the dialog.

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

    A System.String representing the width of the dialog. The default value is auto.

    Remarks

    The width can be specified in pixels (e.g., "300px"), percentage (e.g., "50%"), or as auto to let the dialog size itself based on content.

    See Also
    Height

    ZIndex

    Gets or sets the z-order that determines whether the utility dialog is displayed in front of or behind another component.

    Declaration
    public int ZIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    An System.Int32 representing the z-index value. The default value is 1000.

    Remarks

    The ZIndex value range can be changed depending on the application's needs. Higher values will display the dialog above elements with lower z-index values.

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