Component API

<confirm-dialog>

Open live example

Reusable confirmation dialog: overlay + centered card with a slotted body,
an optional error line, and Cancel/Confirm actions. Instant display:none
display:flex toggle (no transitions). Fires confirm/cancel
(bubbling, composed) instead of owning any deletion logic itself —
callers stay in charge of the request.

Install

import "@f-ewald/components/confirm-dialog.js";

Usage

<confirm-dialog open confirm-label="Delete" cancel-label="Cancel">
  Are you sure you want to delete this item?
</confirm-dialog>

Attributes / properties

PropertyAttributeTypeDefaultDescription
openopenbooleanfalseWhether the dialog is visible.
confirmLabelconfirm-labelstring"Delete"Label for the confirm button.
cancelLabelcancel-labelstring"Cancel"Label for the cancel button.
dangerdangerbooleantrueDanger (red) vs. primary (indigo) styling for the confirm button.
busybusybooleanfalseShows a spinner and disables both buttons while a request is in flight.
errorerrorstring | nullnullInline error line shown below the body, or null for none.

Events

EventDescription
confirmUser clicked the confirm button.
cancelUser clicked the cancel button.

Slots

SlotDescription
(default)Dialog body content.

CSS custom properties

Custom property
--ui-border
--ui-danger
--ui-danger-hover
--ui-focus-ring
--ui-font
--ui-font-size
--ui-font-size-sm
--ui-font-weight-medium
--ui-line-height-normal
--ui-line-height-tight
--ui-on-accent
--ui-overlay
--ui-primary
--ui-primary-hover
--ui-radius
--ui-radius-sm
--ui-shadow-lg
--ui-surface
--ui-text
--ui-text-muted