AstrolUI AstrolUI
Yellow Orange Red Green Blue Purple Custom color
Light mode
Confirm

1. Demo AstrolConfirm

Note
In this example, notifications and buttons are implemented, so it is recommended to refer to their documentation for more details.
@using Astrol.JSInterop.Base
@inject AstrolJSInterop jsI
@using Astrol.Entities.Basic.UI
@using Astrol.Component.Basic.Button
@using Astrol.Component.Basic.Confirm
@using Astrol.Entities.Basic.Static.Notification
 
<AstrolConfirm @ref="_conf" />
<AstrolButton Icon="astrol-trash-empty" Text="Delete" Style="@AstrolStyle.Red" OnClick="DeleteItem" />
@code {
   private AstrolConfirm _conf = default!;
   private async Task DeleteItem() {
       var confirmed = await _conf.Confirmation("Are you sure?", "Do you want to delete the item?");
       if (confirmed) {
            await jsI.Notification("Item removed successfully.".NotificationSuccess());
       }
       else {
           await jsI.Notification("Canceled action.".NotificationError());
       }
   }
}

Usage details

  • Recommended, with the service: @inject IAstrolModal Modal and if (await Modal.ConfirmAsync("Title", "Message")) { ... }. No component in the page and no @ref needed; options with new ConfirmOptions { ... }.
  • With the component: place <AstrolConfirm @ref="_conf" /> in your page with a field private AstrolConfirm _conf; and call await _conf.Confirmation("Title", "Message");, which returns true when accepted:
    • Title (string) message title.
    • Message (string) confirmation message.
  • When it opens, focus is on Accept (Enter confirms) and Esc cancels.

Supported parameters

  • Draggable (bool), the window can be moved (default true).
  • ClosedInteractive (bool), cancels when clicking outside or pressing Esc (default true).
  • Class (string), custom css class.
  • Icon (string), icon (default astrol-question-circle-o).
  • ButtonOutline (bool), buttons without fill (default false).
  • TextAccept / TextCancel (string), button texts (default follows the app language).
  • Width (AstrolWidth), max width: Mini (300px), Short (450px, default), Middle (768px), Large (1200px), Full (100%).
  • Calling Confirmation while another confirmation is open makes the previous one return false.
  • The same options exist in ConfirmOptions for IAstrolModal.ConfirmAsync.
Markdown for AI © 2026 AstrolUI v10.0.13