# SbConfirmDialog A specialized dialog for confirmation actions with predefined variants for different use cases. ## Parameters | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | Title | string | "Confirm" | Dialog title | | Message | string? | null | Dialog message text | | Variant | SbConfirmDialogVariant | Default | Dialog variant (affects icon and button color) | | ConfirmText | string | "Confirm" | Text for confirm button | | CancelText | string | "Cancel" | Text for cancel button | | ShowCancelButton | bool | true | Whether to show cancel button | | CloseOnOverlayClick | bool | true | Close when clicking outside | | Class | string? | null | Additional CSS classes | ## Events | Event | Type | Description | |-------|------|-------------| | OnConfirm | EventCallback | Fired when confirmed | | OnCancel | EventCallback | Fired when cancelled | ## Templates / Slots | Slot | Type | Description | |------|------|-------------| | Icon | RenderFragment | Custom icon content | | ChildContent | RenderFragment | Additional content below message | ## Methods | Method | Return Type | Description | |--------|-------------|-------------| | ShowAsync() | Task\ | Show dialog and await result | | Show() | void | Show dialog (use events for result) | | Close() | void | Close the dialog | ## SbConfirmDialogVariant Enum ```csharp public enum SbConfirmDialogVariant { Default, // Question icon, primary button Danger, // Warning icon, danger button Warning, // Warning icon, warning button Info // Info icon, info button } ``` ## CSS Classes - `sb-confirm-dialog-overlay` - Backdrop overlay - `sb-confirm-dialog` - Dialog container - `sb-confirm-dialog--{variant}` - Variant styles - `sb-confirm-dialog__icon` - Icon container - `sb-confirm-dialog__content` - Content area - `sb-confirm-dialog__title` - Title text - `sb-confirm-dialog__message` - Message text - `sb-confirm-dialog__body` - Custom content area - `sb-confirm-dialog__actions` - Action buttons ## Examples ### Basic Usage ```razor Delete Item @code { private SbConfirmDialog confirmDialog; private async Task DeleteItem() { await itemService.DeleteAsync(item.Id); } } ``` ### Async Usage ```razor Delete @code { private SbConfirmDialog confirmDialog; private async Task HandleDelete() { var confirmed = await confirmDialog.ShowAsync(); if (confirmed) { await DeleteItemAsync(); } } } ``` ### Danger Variant ```razor ``` ### Warning Variant ```razor ``` ### Info Variant ```razor ``` ### Custom Icon ```razor ``` ### With Additional Content ```razor
    @foreach (var user in selectedUsers) {
  • @user.Name (@user.Email)
  • }
``` ### Without Cancel Button ```razor ``` ### Prevent Overlay Close ```razor ``` ### Bulk Delete Confirmation ```razor Delete Selected (@selectedItems.Count) Are you sure you want to delete @selectedItems.Count items? This action cannot be undone. ```