Basic Dialog

<PrimerButton Size="ButtonSize.Small"  @onclick="ToggleDialog">Open Basic Dialog</PrimerButton>
<PrimerDialog Title="Delete Confirmation"
                SubTitle="Are you sure you want to delete?"
                DialogWidth="auto"
                Animation="DialogAnimation.Fade"
                DangerType="false"
                ShowCloseButton="true"
                IsBackdropClickToClose="false"
                FocusTrap="true"
                IsOpen="@isOpen"
                OnClose="@CloseDialog"
                FooterButtons="@dialogButtons">
    This is a basic dialog content.
</PrimerDialog>

Side Dialog

<PrimerButton Size="ButtonSize.Small" @onclick="OpenSideDialog">Open Side Dialog</PrimerButton>
<PrimerSideDialog IsOpen="@isSideOpen"
                    Title="Settings Panel"
                    Style="width:500px"
                    Position="right"
                    OnClose="@(() => isSideOpen = false)">
    <p>This is a side dialog content.</p>
</PrimerSideDialog>

Draggable Dialog

<PrimerButton Size="ButtonSize.Small" @onclick="OpenDraggableDialog">Open Draggable Dialog</PrimerButton>
<PrimerDraggableDialog IsOpen="@isDragOpen"
                        Title="Draggable Dialog"
                        OnClose="@(() => isDragOpen = false)">
    <p>This dialog can be moved freely.</p>
</PrimerDraggableDialog>

Dialog Options

Available options for Dialog component

NameDescriptionDefault ValueCSS Class
IsOpen
Whether the dialog is open
false
-
Title
Dialog title text
"Dialog"
-
SubTitle
Dialog subtitle text
null
-
DangerType
Show danger styling
false
border-danger
ShowCloseButton
Show close button
true
-
IsBackdropClickToClose
Backdrop click to close
true
-
FocusTrap
Trap focus inside dialog
false
-
FooterButtons
Footer button list
empty
-

SideDialog Options

Available options for SideDialog component

NameDescriptionDefault ValueCSS Class
IsOpen
Whether the side dialog is open
false
-
Title
Side dialog title
"Side Dialog"
-
TitleContent
Additional header content
null
-
Position
Position of side dialog
"right"
right, left
Style
Custom width or styles
"400px"
-

DraggableDialog Options

Available options for DraggableDialog component

NameDescriptionDefault ValueCSS Class
IsOpen
Whether the draggable dialog is open
false
-
Title
Dialog title text
"Draggable Dialog"
-
private bool isOpen = false;
private bool isSideOpen = false;
private bool isDragOpen = false;
private List<PrimerDialog.DialogButton> dialogButtons = new();

protected override void OnInitialized()
{
    dialogButtons = new List<PrimerDialog.DialogButton>
    {
        new PrimerDialog.DialogButton { ButtonType = "default", Content = "Cancel", OnClick = CloseDialog },
        new PrimerDialog.DialogButton { ButtonType = "danger", Content = "Delete", OnClick = DeleteItem },
        new PrimerDialog.DialogButton { ButtonType = "primary", Content = "Continue", OnClick = ContinueAction }
    };
}

private void ToggleDialog() => isOpen = !isOpen;
private void CloseDialog() => isOpen = false;
private void OpenSideDialog() => isSideOpen = true;
private void OpenDraggableDialog() => isDragOpen = true;

private void DeleteItem() { }
private async void ContinueAction()
{
    await JSRuntime.InvokeVoidAsync("alert", "Continuing...");
    CloseDialog();
}