Skip to content
GitHub11 stars

A dialog that requires a user response to proceed.

<AlertDialogRoot>
    <AlertDialogTrigger data-color="red" class="alert-dialog-button">Discard draft</AlertDialogTrigger>
    <AlertDialogPortal>

Anatomy

Import the primitives and assemble the parts:

@using Blazix.Primitives

<AlertDialogRoot>
    <AlertDialogTrigger />
    <AlertDialogPortal>
        <AlertDialogBackdrop />
        <AlertDialogViewport>
            <AlertDialogPopup>
                <AlertDialogTitle />
                <AlertDialogDescription />
                <AlertDialogClose />
            </AlertDialogPopup>
        </AlertDialogViewport>
    </AlertDialogPortal>
</AlertDialogRoot>

API Reference

AlertDialogRoot

Doesn't render its own HTML element.

ParameterTypeDefault
Modal PopupModal PopupModal.True
DisablePointerDismissal bool false
Open bool false
OpenChanged

Called with the new value when Open changes, for @bind-Open.

EventCallback<bool> -
OnOpenChange EventCallback<OpenChangeEventArgs> -
OnOpenChangeComplete EventCallback<bool> -
Handle PopupHandle? -
ContentTemplate RenderFragment<object?>? -
ChildContent

The part's content.

RenderFragment? -

AlertDialogTrigger

Renders a <button> element.

ParameterTypeDefault
Disabled

Whether the component should ignore user interaction.

bool false
Handle PopupHandle? -
Payload object? -
NativeButton bool? -
Render RenderFragment<PopupTriggerRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-popup-open

Present when the corresponding alert dialog is open.

-
data-disabled

Present when the trigger is disabled.

-

AlertDialogPortal

Doesn't render its own HTML element.

ParameterTypeDefault
KeepMounted bool false
ChildContent

The part's content.

RenderFragment? -

AlertDialogBackdrop

Renders a <div> element.

ParameterTypeDefault
ForceRender bool false
Render RenderFragment<PopupRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-open

Present when the dialog is open.

-
data-closed

Present when the dialog is closed.

-
data-starting-style

Present when the dialog begins animating in.

-
data-ending-style

Present when the dialog is animating out.

-

AlertDialogPopup

Renders a <div> element.

ParameterTypeDefault
KeepMounted bool false
InitialFocus string? -
FinalFocus string? -
PositionerAttributes IReadOnlyDictionary<string, object>? -
Render RenderFragment<DialogPopupRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-open

Present when the dialog is open.

-
data-closed

Present when the dialog is closed.

-
data-nested

Present when the dialog is nested within another dialog.

-
data-nested-dialog-open

Present when the dialog has other open dialogs nested within it.

-
data-starting-style

Present when the dialog begins animating in.

-
data-ending-style

Present when the dialog is animating out.

-
CSS variableType
--nested-dialogs

Indicates how many dialogs are nested within.

number

AlertDialogTitle

Renders a <h2> element.

ParameterTypeDefault
Render RenderFragment<PopupRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AlertDialogDescription

Renders a <p> element.

ParameterTypeDefault
Render RenderFragment<PopupRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AlertDialogClose

Renders a <button> element.

ParameterTypeDefault
Disabled

Whether the component should ignore user interaction.

bool false
NativeButton bool? -
Render RenderFragment<PopupTriggerRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-disabled

Present when the button is disabled.

-

AlertDialogViewport

Renders a <div> element.

ParameterTypeDefault
KeepMounted bool false
InitialFocus string? -
FinalFocus string? -
PositionerAttributes IReadOnlyDictionary<string, object>? -
Render RenderFragment<DialogPopupRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-open

Present when the dialog is open.

-
data-closed

Present when the dialog is closed.

-
data-nested

Present when the dialog is nested within another dialog.

-
data-nested-dialog-open

Present when the dialog has other open dialogs nested within it.

-
data-starting-style

Present when the dialog begins animating in.

-
data-ending-style

Present when the dialog is animating out.

-

AlertDialogHandle