Skip to content

@serenity-is/corelib / confirmDialog

Function: confirmDialog()

confirmDialog(message, onYes, options?): Partial<Dialog>

Defined in: src/base/dialogs.tsx:1124

Displays a confirmation dialog with Yes / No (and optional Cancel) buttons.

Parameters

message

RenderableContent

Text or renderable content shown in the dialog body.

onYes

() => void

Callback invoked when the Yes button is clicked.

options?

ConfirmDialogOptions

Additional ConfirmDialogOptions.

Returns

Partial<Dialog>

A Dialog handle (partial when falling back to the native confirm()), whose result is "yes", "no", or "cancel".

Remarks

Falls back to the native confirm() when neither Bootstrap modal nor jQuery UI dialog is available.

Example

confirmDialog("Are you sure you want to delete?", () => {
  // do something when yes is clicked
});