KANTO DS v1.12.0
Customise

Theme

Accent

Font

Corners

Density

Text size

Reset to Kanto
Overlays

kt-confirm-dialog

GitHub Copy link

A centred yes/no overlay for an action worth stopping to think about.

Preview

Delete…

A centred yes/no overlay for an action worth stopping to think about.

<kt-confirm-dialog heading="Delete this entity?" message="This action cannot be undone." confirm-label="Delete" ></kt-confirm-dialog>dialog.open = true; dialog.addEventListener('kt-confirm', () => remove(entity)); dialog.addEventListener('kt-cancel', () => {});

When

Destructive or irreversible work only. Editing belongs in a <kt-side-panel>, which does not block the page behind it. A confirmation on something reversible teaches people to dismiss confirmations.

Defaults that fail safe

role="alertdialog", and focus lands on Cancel, not Confirm. A stray Enter meant for whatever was behind the dialog should not delete anything.

Escape and a backdrop click both report kt-cancel — never kt-confirm. variant="danger" (the default) gives the confirm button the solid red treatment, the only place in Kanto that colour is used.

API

PropertyAttributeTypeDefault
openopenbooleanfalse
headingheadingstring'Are you sure?'
messagemessagestring''
confirmLabelconfirm-labelstring'Confirm'
cancelLabelcancel-labelstring'Cancel'
variantvariant'danger' | 'primary''danger'
EventDescription
kt-confirmConfirm pressed
kt-cancelDismissed — button, Escape or backdrop
SlotDescription
defaultExtra content between message and buttons