New to Telerik UI for Blazor? Start a free 30-day trial

Predefined Dialogs - Alert, Confirm, Prompt

Updated on Oct 1, 2026

Telerik UI for Blazor provides styled substitutes to the standard alert, confirm, and prompt dialogs of the browser. These Blazor popup messages match the theme of the components to make it obvious to the user that the modal dialog is coming from your application.

Using Predefined Dialogs

To use the alert, confirm, and prompt dialogs (popup messages), receive a cascading parameter of type Telerik.Blazor.DialogFactory. This object exposes the methods you can use to display the predefined dialogs.

RAZOR
[CascadingParameter]
public DialogFactory Dialogs { get; set; }

There are three available ready-made dialogs:

TelerikRootComponent Dependency

The DialogFactory cascading parameter can only be consumed inside child Razor components of the TelerikRootComponent. This is easily achieved in standard Blazor apps where the TelerikRootComponent resides inside the layout file.

If the TelerikRootComponent is not available, or if it's at the wrong place in the app, the DialogFactory will trigger a NullReferenceException.

Using await

The DialogFactory methods must be awaited. Do not use them with discard variables (_). If you don't need to await the user response, then use the <TelerikDialog> component declaratively.

Showing Multiple Predefined Dialogs

The DialogFactory supports only one open popup dialog at a time. Showing multiple predefined dialogs simultaneously can result in unexpected app behavior. If a long asynchronous operation can end with the display of a DialogFactory popup, the application should prevent the user from triggering additional predefined dialogs before the time consuming operation completes. Consider a LoaderContainer to block the whole user interface or a specific component.

Alert

The alert dialog is a Blazor popup message. It shows the user that something went wrong, such as a major error that requires their attention and blocks the UI, as opposed to a notification that is not modal and is small.

Use an Alert dialog

Example
View Source
Loading ...

Confirm

The confirm dialog returns a bool value that indicates which button the user clicked - true for the OK button and false for the Cancel button. This lets you await its execution, and then continue the application logic based on that decision. The method that calls it must be async Task and not async void in order to await the execution.

Use a Confirm dialog

Example
View Source
Loading ...

Prompt

The prompt dialog returns a string that the user enters when they press OK, and null when they press Cancel. This lets you await its execution, and then continue the application logic based on that decision. The method that calls it must be async Task and not async void in order to await the execution.

Use a Prompt dialog

Example
View Source
Loading ...

See Also