Skip to content

Popconfirm

Use Popconfirm to ask “are you sure?” right next to the button of a small action that is easy to regret: delete a row, remove a member, discard a draft. When the decision needs more explanation or input, use a Modal; for a hint that asks nothing, use a Tooltip.

The trigger is the single child, and it receives the popover’s ref and event handlers. Text is wrapped in a span; a component of your own must pass ref and the other props on to its DOM element, or the popover can’t open or find its place.

Popconfirm is a click-triggered Popover with a question and Cancel / Confirm buttons.

Demos

Basic

Focus moves to Cancel when it opens (the safe choice), Escape or a click outside cancels, and focus returns to the trigger when it closes.

Async and cancelled confirmation

Return a promise from onPositiveClick and Confirm shows a spinner until it settles. Return false (or a promise of false) to keep the popconfirm open.

Buttons, icon and actions

positiveText={null} or negativeText={null} hides a button, showIcon={false} hides the icon, and action replaces both buttons.

Props

NameTypeDefaultDescriptionVersion
contentReactNodeundefinedThe question.Unreleased
positiveTextReactNode | nulllocale “Confirm”Confirm button text; null hides it.Unreleased
negativeTextReactNode | nulllocale “Cancel”Cancel button text; null hides it.Unreleased
positiveButtonPropsPartial<ButtonProps>undefinedExtra props for Confirm, such as type: "error" for a destructive action.Unreleased
negativeButtonPropsPartial<ButtonProps>undefinedExtra props for Cancel.Unreleased
showIconbooleantrueShow the warning icon.Unreleased
iconReactNodeundefinedReplaces the warning icon.Unreleased
actionReactNodeundefinedReplaces both buttons.Unreleased
onPositiveClick(event: MouseEvent) => boolean | void | Promise<boolean | void>undefinedCalled by Confirm. false keeps it open; a promise shows a spinner.Unreleased
onNegativeClick(event: MouseEvent) => boolean | void | Promise<boolean | void>undefinedCalled by Cancel. false keeps it open.Unreleased

It also takes every Popover prop except header and footer; trigger defaults to click. The surface is an alertdialog.