Dialogs

DialogControl

Ask users to confirm, enter a value or edit a record in a movable, resizable window.

Overview

DialogControl is a Blazor dialog window, modal or non-modal, that users can move and resize, with a default button for Enter and Escape to close. Use modal for a decision the page must wait for, such as refunding a charge, and non-modal for a tool window users keep open while they work. For a quick confirm, alert or prompt, any component can await one call on IDialogService, such as ConfirmAsync.

Examples

#Non-modal window

Open the ticket details and keep clicking tickets: a non-modal window leaves the page live and follows the selection. Drag or resize it and the bound size and position report back.

480px × 240px, centered

#Message box, prompt and the dialog service

Each button awaits an answer from IDialogService or a MessageBoxControl, and the ticket above follows: rename it with a prompt, send the reply after a confirmation, and refund the charge only after checking the acknowledgment box. Notes opens a multi-line prompt.

TKT-1043 · Hermione Ranger · Charged twice in October
Status: Open · Notes: 0 characters

Documentation

ParameterTypeDefaultDescription
VisibleboolfalseShown or not. Two-way with @bind-Visible; closing sets it false.
Headerstring?nullTitle-bar text; also the accessible name.
HeaderContentRenderFragment?nullTitle-bar markup in place of Header's plain text, such as a ticket subject with a smaller caption. Dragging, the window menu and the close button work as with Header, and it names the dialog the same way.
ChildContentRenderFragment?—Body.
FooterContentRenderFragment?nullFooter, right-aligned flex row. Rendered only when set.
Width / Heightstring?nullCSS sizes. Two-way: a resize reports the new values through WidthChanged / HeightChanged.
PositionDialogPosition?nullOffset from center after a drag. Two-way with @bind-Position.
IsModalbooltruetrue dims and blocks the page; false leaves it live.
ShowCloseIconbooltrueThe ✕ in the title bar.
CloseOnEscapebooltrueEscape requests close.
OnEscapeEventCallback—When set, Escape runs this instead of closing. For dialogs whose close commits.
OnEnterEventCallback—Default button. A plain Enter anywhere in the dialog runs it after the focused control has handled the key; buttons, links, editors, grids and open dropdowns keep Enter.
CloseOnCtrlEnterboolfalseCtrl+Enter requests close.
HostKeyboardShortcutsIReadOnlyCollection<string>?nullKeys your page handles for the whole window, written like "Ctrl+S" or "Meta+S", modifiers in the order Ctrl, Alt, Shift, Meta. The dialog stops the browser's own action for them, such as saving the page, wherever focus is, and lets the key reach your handler. A nested dialog keeps its own keys.
CloseOnOverlayClickboolfalseA click on the dimmed backdrop requests close.
OnClose / ClosedEventCallback—Both run on every close request (✕, Escape, Alt+F4, system menu), in that order, then Visible goes false.
DraggablebooltrueTitle bar drags the window.
ResizablebooltrueEight resize handles.
MinResizeWidth / MinResizeHeightdouble320 / 160Resize floor in pixels.
MaxResizeWidth / MaxResizeHeightdouble0Resize ceiling in pixels; 0 means none.
ShowSystemMenubooltrueRight-click on the title bar opens the Move / Close menu.
ShowWindowIconboolfalseIcon at the left of the title bar that opens the same menu.
AutoFocusbooltrueFocus the first focusable control on open.
AriaLabel / AriaDescribedBystring?nullAccessible name when there is no header; id of a description.
CssClassstring?nullExtra classes on the window; fx-dialog-classic switches the frame.
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.