Confirm button

Two-step inline confirmation that turns a default button into a danger button after the first click.

Examples

Properties

PropertyAttributeDescriptionType nameTypeDefault
labellabelIdle button text when the default slot is emptystringstring""
confirmLabelconfirm-labelButton text in confirm state when the `confirm-label` slot is emptystringstring""
confirmInfoconfirm-infoOptional helper text above the button in confirm statestringstring""
sizesize`s` | `m` | `l`DuoButtonSize"s" | "m" | "l""m"
squaresquareIcon-only while idle; confirm state always shows `confirm-label` (color-only change is not enough)booleanbooleanfalse
disableddisabledDisables the control and exits confirm statebooleanbooleanfalse
confirmingconfirmingWhether the control is in confirm statebooleanbooleanfalse
accessibleLabelaria-labelAccessible name when the control is icon-onlystring | undefinedstring | undefined—

Slots

NameDescription
defaultIdle button label (used when `label` is empty; omit for icon-only)
confirm-labelConfirm-state label (used when `confirm-label` is empty)
iconLeading icon (e.g. `<duo-icon>`). Pair with `square` and `aria-label` for icon-only.

Usage

Confirm button is a default duo-button that arms on the first click (danger variant + confirm label) and confirms on the second. Optional confirm-info appears above the button while armed. Escape, an outside click, or focus leaving the control cancels without running the action.

Do

  • Use a specific confirm label such as “Click again to delete”, not “Are you sure?” — as confirm-label or the confirm-label slot.
  • Listen for confirm — never treat the first click as the action.
  • Use confirm-info for a short consequence (“This cannot be undone.”).
  • Prefer this in dense lists or settings where a modal would interrupt.
  • Put a duo-icon in the icon slot for icon + text, or set square with aria-label for an icon-only idle state. Confirm state always shows confirm-label — a color change alone is not enough.

Don’t

  • Don’t use it for high-risk legal or financial actions — use duo-modal.
  • Don’t add a timeout to leave confirm state; Escape and leaving the control are the cancel paths.
  • Don’t ship an icon-only control without aria-label (or label).

Events

EventWhen
confirmstartFirst activation; confirm state entered
confirmSecond activation; user confirmed
confirmcancelConfirm state left without confirming

Slots

SlotPurpose
defaultIdle label (preferred over the label attribute when present)
confirm-labelConfirm-state label (preferred over the confirm-label attribute when present)
iconLeading icon (duo-icon); use with visible text or square