View as Markdown

API reference: @salmonui/overlays/dialog

ConfirmOptionsinterface

import type { ConfirmOptions } from '@salmonui/overlays/dialog';
interface ConfirmOptions extends Pick<AlertDialogProps, 'title' | 'description' | 'confirmLabel' | 'cancelLabel' | 'tone' | 'confirmIcon' | 'cancelIcon' | 'localeText' | 'className' | 'style'> {
    readonly signal?: AbortSignal | undefined;
    readonly onConfirm?: (() => unknown) | undefined;
}

Options of useConfirm() / useAlert().

ConfirmOptions members (10, 8 inherited)
NameSignatureDescription
signaloptionalreadonly signal?: AbortSignal | undefined;

Aborting closes the dialog; the promise resolves false (confirm) or undefined (alert).

onConfirmoptionalreadonly onConfirm?: (() => unknown) | undefined;

Runs on confirm before the dialog closes. A returned promise keeps it open with a loading confirm button until it settles: fulfilled, the call resolves true; rejected, the error shows in the dialog (as on AlertDialog) and Cancel still resolves false.

titleinheritedtitle: ReactNode;
descriptionoptionalinheriteddescription?: ReactNode;
confirmLabeloptionalinheritedconfirmLabel?: ReactNode;
cancelLabeloptionalinheritedcancelLabel?: ReactNode;

Without a cancel label (and without localeText.cancel plus onCancel) the dialog is an alert with one action.

confirmIconoptionalinheritedconfirmIcon?: ReactNode;
cancelIconoptionalinheritedcancelIcon?: ReactNode;
toneoptionalinheritedtone?: "danger" | "primary";

'danger' styles the confirm button for destructive actions.

localeTextoptionalinheritedlocaleText?: AlertDialogLocaleText;