Skip to content
GitHub11 stars

A modal dialog that interrupts the user with important content and expects a response.

<AlertDialog>
    <AlertDialogTrigger>
        <Render>

Installation

dnx Blazix.Cli add alert-dialog

Usage

<AlertDialog>
    <AlertDialogTrigger>
        <Render>
            <Button @attributes="context.Attributes" Variant="ButtonVariant.Outline">Show Dialog</Button>
        </Render>
    </AlertDialogTrigger>
    <AlertDialogContent>
        <AlertDialogHeader>
            <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
            <AlertDialogDescription>
                This action cannot be undone. This will permanently delete your account from our servers.
            </AlertDialogDescription>
        </AlertDialogHeader>
        <AlertDialogFooter>
            <AlertDialogCancel>Cancel</AlertDialogCancel>
            <AlertDialogAction>Continue</AlertDialogAction>
        </AlertDialogFooter>
    </AlertDialogContent>
</AlertDialog>

Composition

Use the following composition to build an AlertDialog:

AlertDialog
├── AlertDialogTrigger
└── AlertDialogContent
    ├── AlertDialogHeader
    │   ├── AlertDialogMedia
    │   ├── AlertDialogTitle
    │   └── AlertDialogDescription
    └── AlertDialogFooter
        ├── AlertDialogCancel
        └── AlertDialogAction

Basic

A basic alert dialog with a title, description, and cancel and continue buttons.

<AlertDialog>
    <AlertDialogTrigger>
        <Render>

Small

Use the size="sm" parameter to make the alert dialog smaller.

<AlertDialog>
    <AlertDialogTrigger>
        <Render>

Media

Use the AlertDialogMedia component to add a media element such as an icon or image to the alert dialog.

<AlertDialog>
    <AlertDialogTrigger>
        <Render>

Small with Media

Use the size="sm" parameter to make the alert dialog smaller and the AlertDialogMedia component to add a media element such as an icon or image to the alert dialog.

<AlertDialog>
    <AlertDialogTrigger>
        <Render>

Destructive

Use the AlertDialogAction component to add a destructive action button to the alert dialog.

<AlertDialog>
    <AlertDialogTrigger>
        <Render>

RTL

To enable RTL support in Blazix, see the RTL configuration guide.

Translated with AI for the demo, so it may have mistakes.

<div class="flex flex-wrap justify-center gap-4">
    <AlertDialog>
        <AlertDialogTrigger>

API Reference

AlertDialog

ParameterTypeDefault
Open bool false
OpenChanged EventCallback<bool> -
OnOpenChange EventCallback<OpenChangeEventArgs> -
OnOpenChangeComplete EventCallback<bool> -
ChildContent RenderFragment? -

AlertDialogAction

ParameterTypeDefault
Variant ButtonVariant ButtonVariant.Default
Size ButtonSize ButtonSize.Default
Type ButtonType ButtonType.Button
Disabled bool false
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

AlertDialogCancel

ParameterTypeDefault
Variant ButtonVariant ButtonVariant.Outline
Size ButtonSize ButtonSize.Default
Disabled bool false
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

AlertDialogContent

ParameterTypeDefault
Render RenderFragment<DialogPopupRenderProps>? -
Size AlertDialogSize AlertDialogSize.Default
InitialFocus string? -
FinalFocus string? -
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

AlertDialogDescription

ParameterTypeDefault
Render RenderFragment<PopupRenderProps>? -
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

AlertDialogFooter

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

AlertDialogHeader

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

AlertDialogMedia

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

AlertDialogOverlay

ParameterTypeDefault
Class string? -

Other attributes are passed to the element it renders.

AlertDialogTitle

ParameterTypeDefault
Render RenderFragment<PopupRenderProps>? -
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

AlertDialogTrigger

ParameterTypeDefault
Render RenderFragment<PopupTriggerRenderProps>? -
NativeButton bool? -
Disabled bool false
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.