Popconfirm
A lightweight inline confirmation bubble anchored to its trigger, for low-stakes confirmations that do not warrant a modal. It wraps the shared Dropdown Panel base, so press-to-toggle, outside-press and Escape dismissal, focus return and one-open-at-a-time are the web component's. Reach for Alert Dialog when the action deserves a focus-trapping modal.
Unlike its Popover and Hover Card cousins this stays a single component: the panel is entirely prescribed — a title, an optional description and two buttons — so the one content channel a piece gets goes to the trigger.
Delete this item?
Publish these changes?
Everyone on the team sees them immediately.
Last action: nothing yet
Installation
Copy the piece into your app. It pulls the shared dropdown-panel base along with it:
puzzle add piece popconfirm
That base has a runtime dependency — the web component it wraps:
npm install @magic-spells/dropdown-panel
Then merge its stylesheets into your app's style entry. The first is required; the second adds the entrance effects and the drawn trigger arrow:
/* app/styles/styles.css */ @import "tailwindcss"; @import "@magic-spells/dropdown-panel/css" layer(components); /* required */ @import "@magic-spells/dropdown-panel/css/effects" layer(components); /* optional */
Requires the pieces.css tokens merged into your app styles (see Introduction).
Usage
import Popconfirm from '@/components/ui/Popconfirm.pzl';
<Popconfirm title="Delete this item?" confirmLabel="Delete" variant="danger" @confirm={ remove }>
<span class="…">Delete</span>
</Popconfirm>
// No children? The stock secondary button renders from the label prop:
<Popconfirm title="Publish these changes?" label="Publish" @confirm={ publish } />The children are the trigger, and the stock secondary button is their fallback: pass none and label renders that button; pass your own and they replace it entirely, so a custom trigger must carry its own accessible name. Keep that content non-interactive — the trigger element is the control, so a nested button would be a second tab stop.
In a row of records
- Invoice #118
Delete Delete invoice #118?
This cannot be undone.
- Invoice #119
Delete Delete invoice #119?
This cannot be undone.
align="end" keeps each bubble inside the card — pure CSS, no measuring pass.
Reference
titleThe question. (Was `message` before 0.7.0.)descriptionA second line under the question.labelText for the STOCK trigger — the fallback only. Call-site children win over it.confirmLabelDefaults to "Confirm".cancelLabelDefaults to "Cancel".variant'danger' tints the confirm button destructive.align'start' (default) | 'end' — which edge the bubble hangs from.openOptional-controlled and edge-triggered. Omit it and the component owns its own state.classMerged onto the panel.triggerClassMerged onto the trigger element.@confirmThe Confirm button was pressed; the bubble then closes and focus returns to the trigger.@cancelThe Cancel button was pressed. Escape and outside presses do NOT fire this.@show / @hideEvery open and close, dismissals included.