humanonlyweb/ui

Confirm Dialog

Asks to confirm or cancel an action.

Markdown

Examples

Destructive

Delete this project?

Its files and history are removed for everyone. This can't be undone.

Copy code

Async action

With keep-open, Confirm doesn't close the dialog. Set loading while your action runs, then close it yourself; it can't be cancelled while loading.

Delete feature/login?

Unmerged commits on it are lost.

Copy code

API

PropTypeDefault
title

Heading, which names the dialog.

string—
description

Supporting text, announced as the dialog's description.

string—
confirmText

Confirm button text. Defaults to the confirm translation.

string—
cancelText

Cancel button text. Defaults to the cancel translation.

string—
danger

Destructive action: a danger-styled confirm, and Cancel takes initial focus.

booleanfalse
loading

The confirmed action is running: Confirm shows it, and the dialog can't be cancelled.

booleanfalse
keepOpen

Stay open after Confirm, e.g. while loading; close it by setting open to false.

booleanfalse
open

Whether the dialog is open.

booleanfalse
EventPayload
cancel

Cancelled by the button or Escape.

[]
confirm

The confirm button was pressed.

[]
update:open

v-model:open update.

[value: boolean]
SlotProps
default

Extra body content.

—
spinner

The Confirm button's spinner while loading.

—

Styling

Parts
buttonbutton-spinnerbutton-labeldialogdialog-paneldialog-headerdialog-header-textdialog-titledialog-descriptiondialog-closedialog-bodydialog-footer
States
data-button-variantdata-button-sizedata-button-full-widthdata-button-disableddata-button-loadingdata-dialog-sizedata-dialog-flush

Keyboard

KeysAction
EscapeCancel
TabCycle between the buttons

Accessibility

  • The backdrop doesn't close it.
  • With danger, Cancel gets initial focus.