Skip to content
English

How it works

The popover is placed against the closest data-ds-boundary element or the viewport, shifting sideways with its arrow kept on the trigger and flipping when there is no room. While a returned promise is pending both buttons hold: the label lifts away for a spinner, then a check is drawn and the popover closes after 650ms.

Use it for

  • Confirming a single, reversible-but-costly inline action such as removing a member or revoking a link.
  • Places where a full dialog would feel heavy.

Look elsewhere when

  • Irreversible actions with wide impact: use a confirm dialog that names what is lost.
  • Actions that can simply be undone: act and offer Undo instead.

Usage

import { Popconfirm } from './Popconfirm.jsx'

export function RemoveMember({ member }) {
  return (
    <Popconfirm
      title={`Remove ${member.name}?`}
      description="They lose access to every project right away."
      confirmLabel="Remove"
      onConfirm={() => api.removeMember(member.id)}
    >
      <button type="button">Remove</button>
    </Popconfirm>
  )
}

Props

PropTypeDefaultWhat it does
childrenReactElement—The trigger button; it gets aria-haspopup and aria-expanded.
titleReactNode—The question.
descriptionReactNode—The consequence, in one sentence.
onConfirm() => void | Promise—Runs on confirm. A promise shows progress; rejecting keeps the popover open with errorLabel.
tone'danger' | 'default''danger'Red confirm and warning icon, or ink and a question icon.
side'top' | 'bottom''top'Preferred side; flips when there is no room.
confirmLabel / cancelLabel / errorLabelstring'Confirm' / 'Cancel' / 'That didn’t work. Try again.'Button and error text.
defaultOpenbooleanfalseOpen on first render (without taking focus).
onOpenChange(open: boolean) => void—Called when it opens or closes.

Accessibility

  • role alertdialog labelled by the title and described by the description; the trigger carries aria-haspopup and aria-expanded.
  • Opening moves focus to Cancel, so Enter never confirms by accident; Tab cycles between the two buttons.
  • Escape, Cancel or a click outside closes it and returns focus to the trigger.
  • The confirm button sets aria-busy while waiting; an error is announced with role alert.
  • Danger is shown by an icon and wording, not colour alone.
  • With reduced motion the popover fades and the spinner turns slowly.

Motion

Enter 200ms cubic-bezier(0.32, 1.25, 0.5, 1) from 0.94 scale at the arrow; leave 120ms; label lifts 4px, spinner and check spring in, check stroke draws in 280ms.

Add it to your project

Copy the prompt into Codex or Claude Code. The agent reads the published source, shows you what it will write and adds the component next to your own.

Popconfirm.jsxpopconfirm.csstokens.cssREADME.md

Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

Overlays
Bottom sheet comes with Pro. Its preview shows once you unlock it.