Skip to content

Popconfirm

WxPopconfirm asks are you sure where the answer will land, instead of in the middle of the screen.

Asked where the answer lands
An answer that takes a moment

Usage

vue
<template>
  <wx-popconfirm
    title="Delete this order?"
    description="It cannot be brought back."
    confirm-text="Delete"
    confirm-type="danger"
    @confirm="remove(order)"
  >
    <template #trigger>
      <wx-action type="remove" />
    </template>
  </wx-popconfirm>
</template>

Why not a dialog

Deleting one row out of forty is a small decision made in one place. A modal blanks the page to ask about it, and takes away the row the reader was looking at — which is exactly the thing they were checking before answering.

Use a Dialog when the decision is worth stopping for: deleting an account, publishing to production, anything that needs more than a sentence to explain.

And use neither when the action can simply be undone. A toast with an Undo is better than a confirmation for anything reversible — it costs the reader nothing when they meant it, which is most of the time.

Ask about the consequence

Delete this order? with It cannot be brought back. — not Are you sure?. The question should say what will happen, and the confirming button should say what it does: Delete, not OK. A reader skimming a red button labelled Delete cannot mistake it for anything else.

An answer that takes time

loading keeps the panel open and the confirming button busy while the request is in flight. The caller closes it when the work is done:

vue
<wx-popconfirm v-model:open="open" :loading="saving" @confirm="archive">…</wx-popconfirm>

Without loading the panel closes as soon as the question is answered.

Props

PropTypeDefaultDescription
titlestringThe question
descriptionstringWhat else the reader should know
confirmTextstring'Yes'Label of the button that goes ahead
cancelTextstring'Cancel'Label of the one that does not
confirmTypeButtonType'primary'danger for anything that destroys
iconIconName | false'warning'The glyph beside the question
sidePopoverSide'top'Preferred side
alignPopoverAlign'center'How it lines up
offsetnumber8Distance from the trigger
arrowbooleantrueThe little pointer
widthnumber | string260Width of the panel
disabledbooleanfalseThe trigger asks nothing
loadingbooleanfalseKeeps it open while the answer is worked

Models: v-model:open.

Events: confirm, cancel. Dismissing by Escape or a click outside counts as a cancel — and is reported once, not twice.

Slots: trigger — exactly one element; default — replaces the question; actions — replaces the buttons, with { confirm, cancel }.

Released under the MIT License.