Table of Contents

Class MudDialog

Namespace
MudBlazor
Assembly
MudBlazor.dll

An overlay providing the user with information, a choice, or other input.

public class MudDialog : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged
Inheritance
MudDialog
Implements
Inherited Members
Extension Methods

Constructors

MudDialog()

Creates a new instance.

public MudDialog()

Properties

ActionsClass

The CSS classes applied to the action buttons content.

[Parameter]
[Category("Appearance")]
public string? ActionsClass { get; set; }

Property Value

string

Remarks

Multiple classes must be separated by spaces.

ActionsClassname

protected string ActionsClassname { get; }

Property Value

string

ContentClass

The CSS classes applied to the main dialog content.

[Parameter]
[Category("Appearance")]
public string? ContentClass { get; set; }

Property Value

string

Remarks

Multiple classes must be separated by spaces.

ContentClassname

protected string ContentClassname { get; }

Property Value

string

ContentStyle

The CSS styles applied to the main dialog content.

[Parameter]
[Category("Appearance")]
public string? ContentStyle { get; set; }

Property Value

string

DefaultFocus

The element which will receive focus when this dialog is shown.

[Parameter]
[Category("Behavior")]
public DefaultFocus DefaultFocus { get; set; }

Property Value

DefaultFocus

Remarks

Defaults to Element in DefaultFocus.

DialogActions

The custom actions for this dialog.

[Parameter]
[Category("Behavior")]
public RenderFragment? DialogActions { get; set; }

Property Value

RenderFragment

DialogContent

The main content for this dialog.

[Parameter]
[Category("Behavior")]
public RenderFragment? DialogContent { get; set; }

Property Value

RenderFragment

DialogService

[Inject]
protected IDialogService DialogService { get; set; }

Property Value

IDialogService

Gutters

Adds padding to the sides of this dialog.

[Parameter]
[Category("Appearance")]
public bool Gutters { get; set; }

Property Value

bool

Remarks

Defaults to true.

OnBackdropClick

Occurs when the area outside the dialog has been clicked if BackdropClick is true.

[Parameter]
[Category("Behavior")]
public EventCallback<MouseEventArgs> OnBackdropClick { get; set; }

Property Value

EventCallback<MouseEventArgs>

Remarks

When set, this event will be called instead of the default backdrop click behavior of closing the dialog.

OnKeyDown

Occurs when a key has been pressed down.

[Parameter]
public EventCallback<KeyboardEventArgs> OnKeyDown { get; set; }

Property Value

EventCallback<KeyboardEventArgs>

OnKeyUp

Occurs when a pressed key has been released.

[Parameter]
public EventCallback<KeyboardEventArgs> OnKeyUp { get; set; }

Property Value

EventCallback<KeyboardEventArgs>

Options

The default options for this dialog.

[Parameter]
[Category("Misc")]
public DialogOptions? Options { get; set; }

Property Value

DialogOptions

Remarks

These options are used if none are provided during the ShowAsync(string?, DialogOptions?) method. This is typically used for inline dialogs.

TitleClass

The CSS classes to apply to the title.

[Parameter]
[Category("Appearance")]
public string? TitleClass { get; set; }

Property Value

string

Remarks

Multiple classes must be separated by spaces.

TitleContent

The custom content for this dialog's title.

[Parameter]
[Category("Behavior")]
public RenderFragment? TitleContent { get; set; }

Property Value

RenderFragment

Remarks

When null, the Title will be used.

Visible

For inline dialogs, shows this dialog.

[Parameter]
[Category("Behavior")]
public bool Visible { get; set; }

Property Value

bool

Remarks

Defaults to false.
This can be bound via @bind-Visible to show or hide inline dialogs. For regular dialogs, use the ShowAsync(Type) and Close() methods.

VisibleChanged

Occurs when Visible has changed.

[Parameter]
public EventCallback<bool> VisibleChanged { get; set; }

Property Value

EventCallback<bool>

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

CloseAsync(DialogResult?)

For inlined dialogs, hides this dialog.

public Task CloseAsync(DialogResult? result = null)

Parameters

result DialogResult

The optional data to include.

Returns

Task

OnAfterRenderAsync(bool)

protected override Task OnAfterRenderAsync(bool firstRender)

Parameters

firstRender bool

Returns

Task

OnInitialized()

protected override void OnInitialized()

ShowAsync(string?, DialogOptions?)

For inlined dialogs, shows this dialog.

public Task<IDialogReference> ShowAsync(string? title = null, DialogOptions? options = null)

Parameters

title string

The title of this dialog.

options DialogOptions

The options for this dialog.

Returns

Task<IDialogReference>

The reference to the displayed instance of this dialog.

See Also