useConfirm
Opens a confirmation dialog and resolves the answer as a promise. The dialog renders with the caller's app context, so the router, plugins and app-level provides reach it. Only one is open at a time: a second confirm() answers the first with false.
Install: pnpm add-composable useConfirm
Await the answer
Call useConfirm() in setup, then await confirm(). Enter on the focused Cancel button cancels: only Enter elsewhere in the dialog confirms.
API
confirm((options?: ConfirmOptions) => Promise<boolean>): Opens the dialog. Resolves true on confirm, false on cancel, Escape, a backdrop click, or another confirm() opening.title(string): Option. The dialog heading.message(string): Option. The description under the heading.confirmLabel(string): Option. The confirm button label: name the action ("Delete account"), not "OK".cancelLabel(string): Option. The cancel button label.variant('danger' | 'primary'): Option. danger for destructive actions (warning icon, danger button); primary for an ordinary yes or no.body(() => VNode | VNode[]): Option. Extra content under the message, such as a list of what will be removed.