Examples
ShowMessageBoxAsync returns true for yes, false for no and null when cancelled or dismissed.
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.
Pass parameters with DialogParameters<T> and await the result.
DialogOptions sets the width, the close button and whether the backdrop or Escape dismisses it.
API
<Dialog>
DaisyBlazorParameters
- 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>
DaisyBlazorParameters
- 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>
DaisyBlazorParameters
- CloseLabel string= null
Accessible label of the close (x) button. Null uses the app-wide Strings.
IDialogService
DaisyBlazorMudBlazor-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
DaisyBlazorMudBlazor-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.