Skip to content

Popconfirm

Displays a popover with confirmation content on click. Commonly used for dangerous prompts, important toggles, and other scenarios.

Basic Usage

Configure simple prompt information via title.

Basic Usage

Placement

Supports 12 directions of popup positioning, controlled via the placement prop.

Placement

Custom Configuration

Freely customize button text, type, or hide specific elements.

Custom Configuration

Advanced Features

YH-UI's unique "button position swap" and "don't ask again" state feedback.

Advanced Features

Async Close

Easily implement API interception logic by combining with the before-confirm prop.

Async Interception

Custom Slots

Use title and description slots to customize complex rich text content.

Complex Content Slot

Hide Arrow

Control whether the popover displays the indicator arrow via the show-arrow prop.

Arrow Display

Theme Appearance

Easily customize component styling by modifying CSS variables. For example, use popper-style to override local theme variables.

Theme Customization

Use in Nuxt

YhPopconfirm fully supports Nuxt 3. Thanks to the Tooltip-based ultra-fast positioning engine, it maintains excellent performance in SSR environments.

Nuxt Demo

Simply add the module configuration in nuxt.config.ts:

ts
export default defineNuxtConfig({ modules: ['@yh-ui/nuxt'] })

API

Props

PropDescriptionTypeDefault
titleTitlestring-
descriptionDescription contentstring-
confirm-button-textConfirm button textstringConfirm
cancel-button-textCancel button textstringCancel
confirm-button-typeConfirm button typestringprimary
cancel-button-typeCancel button typestringdefault
iconIcon namestringwarning
icon-colorIcon colorstring#faad14
hide-iconWhether to hide iconbooleanfalse
hide-cancelWhether to hide cancel buttonbooleanfalse
widthWidthstring / number180
placementPopup positionTooltipPlacement'top'
visibleManual control visibilityboolean | nullnull
offsetOffset [skidding, distance]array[0, 12]
disabledWhether to disablebooleanfalse
show-arrowWhether to show arrowbooleantrue
teleportedWhether to mount to bodybooleantrue
z-indexZ-indexnumber2000
popper-classCustom popover classstring-
popper-styleCustom popover styleobject{}
before-confirmLifecycle hook before confirmfunction-
swap-buttonsWhether to swap button positionsbooleanfalse
show-dont-ask-againWhether to show "don't ask again" checkboxbooleanfalse
dont-ask-again-textText for "don't ask again"stringDon't ask again

Slots

Slot NameDescription
defaultTrigger element for popover
iconCustom icon
titleCustom title
descriptionCustom description content

Events

Event NameDescriptionParameters
confirmTriggered when confirm button is clicked(isSet: boolean)
cancelTriggered when cancel button is clicked-
update:visibleTriggered when visibility changes(visible: boolean)

Theme Variables (CSS Variables)

VariableDefaultDescription
--yh-popconfirm-title#1d1d1fTitle text color
--yh-popconfirm-desc#424245Description text color
--yh-tooltip-bg-colorrgba(255, 255, 255, 0.88)Popover background color
--yh-tooltip-border-colorrgba(0, 0, 0, 0.08)Popover border color

Released under the MIT License.