Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

Popconfirm

Confirm a destructive action beside its trigger.

Preview

Live preview

Changes apply to this preview only.

No confirmation resolved yet

Press Escape or click outside to cancel; both call onCancel as well. The panel closes after the action and focus is already back on the trigger.

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

Custom labels

confirmLabel and cancelLabel accept any node, so an action can carry an icon or a translated label.

Open preview

Controlled open state

The page owns the open state. The external button opens the confirmation on its trigger without a click on it, which is useful for command palettes or keyboard shortcuts.

Open preview

Placement and custom icon

The panel flips when the preferred side has no room, exactly like Popover. icon replaces the default warning glyph.

Open preview

Usage

Use a brief question and explicit confirm/cancel labels. Persist deletion only after confirmation.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

PimoluPopconfirmProps

Type source
PimoluPopconfirmProps public API
NameTypeDefaultDescription
childrenRequiredReactElement<unknown, string | JSXElementConstructor<any>>—The element that opens the confirmation: any element, or a component that passes down the props it receives. Focus returns to it when the confirmation is resolved.
titleRequiredReactNode—Question shown at the top of the panel. It names the dialog.
descriptionReactNode—Optional explanation under the title.
confirmLabelReactNode"Confirm"Label of the confirming action. Defaults to "Confirm".
cancelLabelReactNode"Cancel"Label of the cancelling action. Defaults to "Cancel".
onConfirm(() => void) | undefined—Runs when the confirming action is pressed.
onCancel(() => void) | undefined—Runs when the confirmation is dismissed without confirming: the cancel button, Escape, an outside click, or a second click on the trigger.
variantPimoluPopconfirmVariant | undefined"default"Destructive styling for irreversible actions.
openboolean | undefined—Controlled open state. Omit to let the component own it.
defaultOpenboolean | undefinedfalseInitial open state when uncontrolled. Defaults to false.
onOpenChange((open: boolean) => void) | undefined—Called whenever the component asks to open or close.
placementPimoluPopoverPlacement | undefined"bottom"Preferred side of the trigger. Defaults to "bottom".
offsetnumber | undefined8Distance from the trigger, in pixels. Defaults to 8.
disabledboolean | undefinedfalseNever open. The trigger keeps its own disabled state.
iconReactNode—Custom icon; a warning glyph is used by default.
classNamestring | undefined—Class applied to the popover panel.
childrenRequired

ReactElement<unknown, string | JSXElementConstructor<any>>

No default extracted.

The element that opens the confirmation: any element, or a component that passes down the props it receives. Focus returns to it when the confirmation is resolved.

titleRequired

ReactNode

No default extracted.

Question shown at the top of the panel. It names the dialog.

description

ReactNode

No default extracted.

Optional explanation under the title.

confirmLabel

ReactNode

Default: "Confirm"

Label of the confirming action. Defaults to "Confirm".

cancelLabel

ReactNode

Default: "Cancel"

Label of the cancelling action. Defaults to "Cancel".

onConfirm

(() => void) | undefined

No default extracted.

Runs when the confirming action is pressed.

onCancel

(() => void) | undefined

No default extracted.

Runs when the confirmation is dismissed without confirming: the cancel button, Escape, an outside click, or a second click on the trigger.

variant

PimoluPopconfirmVariant | undefined

Default: "default"

Destructive styling for irreversible actions.

open

boolean | undefined

No default extracted.

Controlled open state. Omit to let the component own it.

defaultOpen

boolean | undefined

Default: false

Initial open state when uncontrolled. Defaults to false.

onOpenChange

((open: boolean) => void) | undefined

No default extracted.

Called whenever the component asks to open or close.

placement

PimoluPopoverPlacement | undefined

Default: "bottom"

Preferred side of the trigger. Defaults to "bottom".

offset

number | undefined

Default: 8

Distance from the trigger, in pixels. Defaults to 8.

disabled

boolean | undefined

Default: false

Never open. The trigger keeps its own disabled state.

icon

ReactNode

No default extracted.

Custom icon; a warning glyph is used by default.

className

string | undefined

No default extracted.

Class applied to the popover panel.

Accessibility

  • Keep a keyboard-accessible cancel path and verify focus restoration after dismissal.
Read the accessibility guide →