Skip to content
GitHub11 stars

A popup that opens on top of the entire page.

<DialogRoot>
    <DialogTrigger class="dialog-button">
        View notifications

Usage guidelines

  • Dialog doesn't support gestures: Use Drawer when you need gestures or snap points. A panel that slides in from the edge of the screen and doesn't need gestures is a positioned Dialog.

Anatomy

Import the primitives and assemble the parts:

@using Blazix.Primitives

<DialogRoot>
    <DialogTrigger />
    <DialogPortal>
        <DialogBackdrop />
        <DialogViewport>
            <DialogPopup>
                <DialogTitle />
                <DialogDescription />
                <DialogClose />
            </DialogPopup>
        </DialogViewport>
    </DialogPortal>
</DialogRoot>

API Reference

DialogRoot

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? -

DialogTrigger

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 dialog is open.

-
data-disabled

Present when the trigger is disabled.

-

DialogPortal

Doesn't render its own HTML element.

ParameterTypeDefault
KeepMounted bool false
ChildContent

The part's content.

RenderFragment? -

DialogBackdrop

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.

-

DialogPopup

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

DialogTitle

Renders a <h2> element.

ParameterTypeDefault
Render RenderFragment<PopupRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

DialogDescription

Renders a <p> element.

ParameterTypeDefault
Render RenderFragment<PopupRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

DialogClose

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.

-

DialogViewport

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.

-

DialogHandle