Skip to content
🌏 Translated with the assistance of DeepSeek and ChatGPT

Popconfirm

A popup with a confirm button.

Popconfirm is similar to Popover in interaction, but focuses on confirmation (confirm/cancel) scenarios for quick confirmation flows.

Basic Usage

Use the content prop to set the message. By default Popconfirm shows an icon, message and footer buttons (confirm/cancel).

Hide source code
Hide source code

Controlled Mode

Passing visible switches the component to controlled mode. If omitted or set to undefined, the component is uncontrolled and defaultVisible can be used to set the initial state. The component emits update:visible to support v-model.

Hide source code

Asynchronous Confirmation

When onBeforeOk is provided, the confirmation process will wait for onBeforeOk to complete. If the result is not false, subsequent code will be executed.

Hide source code

Customize the entire bottom area via the footer slot. Use the icon slot for custom icons; showIcon controls icon visibility. To modify button text or properties only, use okText, cancelText, okButtonProps, and cancelButtonProps.

Hide source code

Disabled State

Set disabled to disable the component. Trigger actions will be ignored and the popup will not open.

Hide source code

API

PopconfirmProps

AttributeTypeOptionalDefaultDescriptionVersion
contentstringTrueText content of the confirmation popup.0.1.0
visibleboolean | nullTrueWhether to display (controlled mode, supports v-model).0.1.0
defaultVisibleboolean | nullTrueDefault visibility state in uncontrolled mode.0.1.0
loadingbooleanTruefalsePass loading to control the loading state of the confirm button.0.1.0
placement'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end'True'top'Popup placement.0.1.0
okTextstringTrueText for the confirm button.0.1.0
cancelTextstringTrueText for the cancel button.0.1.0
showIconbooleanTruetrueWhether to show the default icon.0.1.0
showCancelbooleanTruetrueWhether to show the cancel button.0.1.0
showFooterbooleanTruetrueWhether to show the footer area.0.1.0
offsetnumberTrue8Popup offset distance (pixels).0.1.0
variant'dark' | 'light'True'light'Component style variant (light/dark).0.1.0
arrowbooleanTruetrueWhether to show arrow.0.1.0
disabledbooleanTruefalseWhether disabled.0.1.0
zIndexnumberTruez-index of the popup layer.0.1.0
animationDurationnumberTrue250Duration of the popup show/hide animation.0.1.5
rootHTMLElement | stringTrue'body'Mount element.0.1.0
destroyOnHidebooleanTruefalseWhether to destroy content when hidden.0.1.0
popoverPropsOmit<PopoverProps, 'visible' | 'content' | 'defaultVisible'> & EmitEvent<PopoverEvents>TrueProps passed through to the internal Popover.0.1.0
okButtonPropsButtonProps & EmitEvent<ButtonEvents> & RestAttrsTrueProps and events passed to the confirm button.0.1.0
cancelButtonPropsButtonProps & EmitEvent<ButtonEvents> & RestAttrsTrueProps and events passed to the cancel button.0.1.0
containerPropsRestAttrsTrueDOM attributes passed to the container area.0.1.0
contentPropsRestAttrsTrueDOM attributes passed to the content area container.0.1.0
footerPropsRestAttrsTrueDOM attributes passed to the footer area container.0.1.0

PopconfirmEvents

EventParameterDescriptionVersion
update:visiblevalue: booleanTriggered when v-model updates.0.1.0
beforeOkFor async confirmation. Must return a value of type Promise<boolean | void> | boolean | void. Confirmation succeeds if the result after await is not false.0.1.0
okevent: MouseEventTriggered when the confirm button is clicked (after beforeOk passes).0.1.0
cancelevent: MouseEvent | KeyboardEventTriggered when the cancel button is clicked.0.1.0
closee: MouseEventTriggered when the popup closes.0.1.0
opene: MouseEventTriggered when the popup opens.0.1.0

PopconfirmSlots

SlotParameterDescriptionVersion
defaultSlot for the trigger element.0.1.0
contentCustom content slot.0.1.0
iconCustom icon slot.0.1.0
footerCustom footer slot.0.1.0

PopconfirmExpose

AttributeTypeOptionalDefaultDescriptionVersion
open() => voidFalseOpens the confirmation popup.0.1.0
close() => voidFalseCloses the confirmation popup.0.1.0

RestAttrs

ts
import type { StyleValue } from 'vue'

export type VueClassValue = string | Record<string, any> | VueClassValue[]
export type VueStyleValue = StyleValue

export type RestAttrs = {
	style?: VueStyleValue | null
	class?: VueClassValue | null
	[x: string]: any
}

EmitEvent

ts
export type EmitEvent<T extends Record<string, any>> = {
	[K in keyof T as `on${Capitalize<K & string>}`]?: (...args: T[K]) => void
}