Skip to content
daisyBlazor

Dialog

Modal dialogs opened from code through IDialogService and hosted by DialogProvider. ShowMessageBoxAsync covers quick questions; ShowAsync opens your own component built on Dialog and returns its result.
Feedback.modalReplaces MudDialog
Cover · <Dialog>

Deploy v2.4.0 to production?

12 services restart in all 3 regions on Friday at midnight.

Examples

Message box

ShowMessageBoxAsync returns true for yes, false for no and null when cancelled or dismissed.

Result: none yet
website/Examples/Feedback/DialogMessageBoxExample.razor Source

A dialog component

Lay out the content with Dialog's DialogContent and DialogActions, then close through the cascaded IMudDialogInstance.

Rename task

Static preview: the buttons work once IDialogService opens the dialog.

website/Examples/Feedback/DialogTaskEditorExample.razor Source

Pass parameters with DialogParameters<T> and await the result.

Task 4: Update billing page
website/Examples/Feedback/DialogShowAsyncExample.razor Source

Options

DialogOptions sets the width, the close button and whether the backdrop or Escape dismisses it.

website/Examples/Feedback/DialogOptionsExample.razor Source

API

<Dialog>

DaisyBlazor

Parameters

  • Title string
    = null

    Title text; falls back to the title passed to the dialog service when empty.

  • Class string
    = null

    Extra CSS classes applied to the dialog's root wrapper.

  • Style string
    = null

    Inline CSS style applied to the dialog's root wrapper.

Content

  • Actions RenderFragment

    Alias for DialogActions, used only when DialogActions is not set.

  • ChildContent RenderFragment

    Additional body content, rendered after DialogContent.

  • DialogActions RenderFragment

    Footer actions. DialogActions matches the MudBlazor child-content name; Actions is supported as an alias.

  • DialogContent RenderFragment

    Dialog body content, rendered before ChildContent.

  • TitleContent RenderFragment

    Custom title markup; takes precedence over Title.

<MessageBoxDialog>

DaisyBlazor

Parameters

  • CancelText string
    = null

    Label of the text button that cancels the dialog; hidden when empty.

  • Message string
    = null

    Message text shown in the dialog body; line breaks are preserved.

  • NoText string
    = null

    Label of the outlined button that closes with false; hidden when empty.

  • YesText string
    = "OK"

    Label of the primary button, which closes with true; defaults to "OK".

<DialogProvider>

DaisyBlazor

Parameters

  • CloseLabel string
    = null

    Accessible label of the close (x) button. Null uses the app-wide Strings.

IDialogService

DaisyBlazor

MudBlazor-compatible dialog service. A DialogProvider mounted once in the app listens to OnDialogShown and renders the requested component.

Events

  • OnDialogShown Action<DialogReference>

    Raised when a new dialog is shown so the provider can render it.

Methods

  • ShowAsync<T> (string title, DialogParameters parameters = null, DialogOptions options = null) → Task<IDialogReference>

    Show dialog component T with the given title, parameters and options.

  • ShowMessageBoxAsync (string title, string message, string yesText = "OK", string noText = null, string cancelText = null) → Task<bool?>

    Show a built-in confirm dialog. Returns true for yes, false for no, or null when canceled / dismissed.

DialogOptions

DaisyBlazor

MudBlazor-compatible display options for a dialog.

Properties

  • AlertDialog bool?
    = null

    Render the dialog with role="alertdialog". Defaults to true for MessageBoxDialog and ConfirmDialog, false otherwise.

  • BackdropClick bool?
    = null

    Allow dismissing the dialog by clicking the backdrop.

  • CloseButton bool?
    = null

    Show an explicit close (x) button in the header.

  • CloseOnEscapeKey bool?
    = null

    Allow dismissing the dialog with the Escape key (default: allowed).

  • FullWidth bool?
    = null

    Stretch the dialog box to the chosen max width.

  • MaxWidth MaxWidth?
    = null

    Maximum width of the dialog box.

  • NoHeader bool?
    = null

    Hide the dialog header. Accepted for MudBlazor parity; DialogProvider ignores it for now.

From MudDialog

Dialog keeps MudDialog's parameter names, so most markup moves over by dropping the Mud prefix. See the migration guide for the shared enums, icons and services.

Mount <DialogProvider /> once in your layout, exactly where MudDialogProvider was. IDialogService, DialogParameters, DialogOptions and DialogResult keep their MudBlazor shapes.

<MudDialog> <Dialog>
Something went wrong while running the docs. Reload