Skip to content
Thrum

Confirm popover

A question that opens at the button that asked for it: Delete this row? with Cancel and a confirm button. It keeps the eye where the action is and puts no veil over the page. For an action that deserves the whole screen, use an alert dialog.

Install

npx shadcn@latest add @thrum-pro/confirm-popover

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Props

PropTypeDefaultDescription
childrenReactElementRequiredThe trigger: one button element. A press on it opens the question instead of running the action.
titleReactNodeRequiredThe question, in a few words. It names the panel for screen readers.
descriptionReactNode–One more line under the question, such as what cannot be undone.
confirmLabelstringDefault "Confirm"The words on the button that goes ahead. Use the verb of the action.
cancelLabelstringDefault "Cancel"The words on the button that backs out.
destructivebooleanDefault falseDraw the confirm button in the destructive colour.
onConfirm() => void | Promise<unknown>–Runs when the confirm button is pressed. With a promise, the button shows a spinner and the question cannot be closed until it settles; if it rejects, the question stays open.
onCancel() => void–Runs when the question is closed any other way: Cancel, Escape or a press outside.
openboolean–Whether it is open, when the parent holds the state. Use it with onOpenChange.
defaultOpenbooleanDefault falseWhether it starts open, when it holds its own state.
onOpenChange(open: boolean) => void–Called when the question opens or closes, whatever caused it.
side"top" | "right" | "bottom" | "left"Default "top"The side of the trigger the question opens on. It flips when there is no room.
align"start" | "center" | "end"Default "center"How the question lines up with the trigger along that side.
soundbooleanDefault truePlay a soft sound on opening and on closing, if the visitor has sound on.
classNamestring–Extra classes for the panel. The default is 256 pixels wide.

Motion and sound

Motion

  • The panel fades in and grows from 96% to full size over 150 ms, from the arrow that points at the trigger.
  • Closing plays the same change backwards.
  • While a promise from onConfirm is pending, the confirm button keeps its width and shows the button's spinner.
  • Reduced motion: the panel appears and leaves at once, and the spinner stands still.

Sound

  • A soft rising tone when the question opens.
  • A soft falling tone when it closes, by either answer. Confirming adds no sound of its own.

Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works

Accessibility

  • The panel has role alertdialog, is named by its title and described by its description.
  • Focus starts on Cancel, the answer that changes nothing, and is kept between the two buttons until the question is answered.
  • While it is open the rest of the page cannot be reached by keyboard or screen reader and does not scroll. There is no veil.
  • Escape and a press outside both cancel. Focus goes back to the trigger either way.
  • While the action runs the confirm button says it is busy (aria-busy), keeps the focus and ignores further presses. Escape and a press outside do nothing until it settles.
  • The destructive button differs from Cancel by its filled colour and by its words. Write the action as a verb.
  • Under a glass material the panel and its arrow are translucent. The tint keeps the text at 4.5 to 1 over any page.
KeysAction
Enter / SpaceOn the trigger: open the question. Focus moves to Cancel.
Tab / Shift TabMove between Cancel and the confirm button. Focus stays inside the panel.
Enter / SpacePress the focused button.
EscCancel: close the question without running the action. Focus returns to the trigger.

Source

SourcePro

The source comes with Pro

TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies

Files and dependencies

Adds
components/ui/confirm-popover.tsx
Packages
@base-ui/react@1.9.0
Brings along
Sound engineButtonPopover

Changelog

  1. 1.0.0 · 2026-12-03First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor