New to Telerik UI for BlazorStart a free 30-day trial

Provides programmatic access to display predefined dialog types - Alert, Confirm, and Prompt. Inject as a service or access through cascading parameter for showing modal dialogs without markup. These dialogs follow browser-native patterns with consistent styling and keyboard navigation. USAGE: Perfect for confirmation prompts, user notifications, and simple text input scenarios. STYLING: Dialogs automatically inherit the active Telerik theme styling.

Definition

Namespace:Telerik.Blazor

Assembly:Telerik.Blazor.dll

Syntax:

C#
public class DialogFactory

Inheritance: objectDialogFactory

Methods

Opens an informational alert dialog with custom button text and title. Allows complete control over the acknowledgment button label. Use for localized applications or when "OK" doesn't match your application's vocabulary. LOCALIZATION: Essential for international applications requiring translated button text. UX: Custom button text can make the action more clear ("Got It", "Continue", "Close").

C#
public Task AlertAsync(string text, string title, string okButtonText)
Parameters:textstring

The informational message to display to the user.

titlestring

The dialog title to display in the header bar.

okButtonTextstring

Custom text for the acknowledgment button (replaces "OK").

Returns:

Task

Task that completes when user acknowledges the message.

Opens an informational alert dialog with single OK button and custom title. Displays a message with descriptive title that requires user acknowledgment. Use when you need to categorize the alert or provide additional context through the title. CONTEXT: Title helps users understand the nature of the alert (Error, Warning, Success, etc.). BRANDING: Custom titles maintain consistency with your application's messaging patterns.

C#
public Task AlertAsync(string text, string title)
Parameters:textstring

The informational message to display to the user.

titlestring

The dialog title to display in the header bar.

Returns:

Task

Task that completes when user acknowledges the message.

Opens an informational alert dialog with single OK button using the default page title. Displays a message that requires user acknowledgment before continuing. Use for notifications, warnings, or informational messages that don't require decisions. BEHAVIOR: Dialog blocks interaction with page content until user clicks OK or presses Escape. UX: Perfect for success messages, error notifications, or important announcements.

C#
public Task AlertAsync(string text)
Parameters:textstring

The informational message to display to the user.

Returns:

Task

Task that completes when user acknowledges the message.

Opens a confirmation dialog with fully customized button text and title. Allows complete control over dialog appearance including button labels. Use for localized applications or when standard OK/Cancel text doesn't fit your context. RETURN: true if user clicks the OK button, false if user clicks Cancel button or closes dialog. LOCALIZATION: Essential for international applications requiring translated button text.

C#
public Task<bool> ConfirmAsync(string text, string title, string okButtonText, string cancelButtonText)
Parameters:textstring

The message to display to the user asking for confirmation.

titlestring

The dialog title to display in the header bar.

okButtonTextstring

Custom text for the confirmation button (replaces "OK").

cancelButtonTextstring

Custom text for the cancellation button (replaces "Cancel").

Returns:

Task<bool>

Task that resolves to true for confirmation, false for cancellation.

Opens a confirmation dialog with yes/no options and custom title. Displays the specified text and title with OK and Cancel buttons for user decision. Use when you need to provide context through a descriptive title. RETURN: true if user clicks OK/confirms, false if user clicks Cancel or closes dialog. BRANDING: Custom title helps establish context and maintain consistent messaging.

C#
public Task<bool> ConfirmAsync(string text, string title)
Parameters:textstring

The message to display to the user asking for confirmation.

titlestring

The dialog title to display in the header bar.

Returns:

Task<bool>

Task that resolves to true for confirmation, false for cancellation.

Opens a confirmation dialog with yes/no options using the default page title. Displays the specified text with OK and Cancel buttons for user decision. Use for simple confirmation scenarios like "Are you sure you want to delete this item?". RETURN: true if user clicks OK/confirms, false if user clicks Cancel or closes dialog. ACCESSIBILITY: Dialog is modal and supports keyboard navigation (Enter=OK, Escape=Cancel).

C#
public Task<bool> ConfirmAsync(string text)
Parameters:textstring

The message to display to the user asking for confirmation.

Returns:

Task<bool>

Task that resolves to true for confirmation, false for cancellation.

Opens a fully customizable text input dialog with default text and custom button labels. Provides complete control over dialog appearance including button text and pre-filled input. Use for localized applications or when you need complete control over dialog messaging. RETURN: User's final text input if they click OK button, null if they click Cancel or close dialog. LOCALIZATION: Essential for international applications requiring translated button text. UX: Combines default text convenience with custom button labels for optimal user experience.

C#
public Task<string> PromptAsync(string text, string title, string defaultInputText, string okButtonText, string cancelButtonText)
Parameters:textstring

The prompt message asking the user for input.

titlestring

The dialog title to display in the header bar.

defaultInputTextstring

Pre-filled text that appears in the input field by default.

okButtonTextstring

Custom text for the confirmation button (replaces "OK").

cancelButtonTextstring

Custom text for the cancellation button (replaces "Cancel").

Returns:

Task<string>

Task that resolves to the user's input text or null if cancelled.

Opens a text input dialog with pre-filled default text and custom title. Displays a message with a text input field that contains initial text the user can modify. Use when you want to suggest a default value or allow editing of existing text. RETURN: User's final text input if they click OK, null if they click Cancel or close dialog. UX: Default text is pre-selected for easy replacement or can be modified as needed.

C#
public Task<string> PromptAsync(string text, string title, string defaultInputText)
Parameters:textstring

The prompt message asking the user for input.

titlestring

The dialog title to display in the header bar.

defaultInputTextstring

Pre-filled text that appears in the input field by default.

Returns:

Task<string>

Task that resolves to the user's input text or null if cancelled.

Opens a text input dialog with OK/Cancel buttons and custom title. Displays a message and title with a text input field for user text entry. Use when you need to provide context for the input request through a descriptive title. RETURN: User's text input if they click OK, null if they click Cancel or close dialog. CONTEXT: Title helps explain what the input will be used for or provides additional context.

C#
public Task<string> PromptAsync(string text, string title)
Parameters:textstring

The prompt message asking the user for input.

titlestring

The dialog title to display in the header bar.

Returns:

Task<string>

Task that resolves to the user's input text or null if cancelled.

Opens a text input dialog with OK/Cancel buttons using the default page title. Displays a message with a text input field for user to enter a single line of text. Use for collecting simple text input like names, descriptions, or configuration values. RETURN: User's text input if they click OK, null if they click Cancel or close dialog. UX: Input field is automatically focused when dialog opens for immediate typing.

C#
public Task<string> PromptAsync(string text)
Parameters:textstring

The prompt message asking the user for input.

Returns:

Task<string>

Task that resolves to the user's input text or null if cancelled.