# Confirm Popover

> An "Are you sure?" that opens beside the button that asked, on Base UI Popover, instead of a dialog across the page. Destructive or neutral, it lands focus on Cancel, spins while an async confirm runs and can't be dismissed until it settles, then shows a failure in place. High-risk actions can require typing a name, and repeat ones can offer Don't ask again and then skip the question.

- Slug: `confirm-popover`
- Category: [Popovers](https://www.assembli.design/category/popovers.md)
- Type: component
- Tags: confirm, popconfirm, popover, delete, destructive, inline, are-you-sure, base-ui
- npm dependencies: @base-ui/react, lucide-react
- shadcn/ui dependencies: none
- Live preview: https://www.assembli.design/preview/confirm-popover
- Page: https://www.assembli.design/components/confirm-popover

![Confirm Popover preview](https://www.assembli.design/thumbnails/confirm-popover-light.png)

## Props

Other props pass through to the root element.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `trigger` (required) | `React.ReactElement` |  | The button that asks. It's rendered as the popover's trigger, so it must accept a ref and props. |
| `title` (required) | `React.ReactNode` |  |  |
| `description` | `React.ReactNode` |  |  |
| `intent` | `ConfirmPopoverIntent` | `"destructive"` | Red confirm button and warning icon (`destructive`), or the primary button and a question mark. |
| `confirmLabel` | `React.ReactNode` | `intent === "destructive" ? "Delete" : "Confirm"` |  |
| `cancelLabel` | `React.ReactNode` | `"Cancel"` |  |
| `onConfirm` (required) | `(details: ConfirmDetails) => Promise<void> \| void` |  | Runs on confirm. While its promise is pending the button spins and the popover can't be dismissed; a rejection keeps it open with `errorMessage`. |
| `onCancel` | `() => void` |  |  |
| `confirmText` | `string` |  | For high-risk actions: the confirm button stays disabled until this exact text is typed. |
| `dontAskAgain` | `boolean` | `false` | Offers a "Don't ask again" checkbox; its value arrives in `onConfirm`. |
| `skip` | `boolean` | `false` | Skip the question and confirm straight away, e.g. once someone ticked "Don't ask again". |
| `errorMessage` | `React.ReactNode` | `"That didn't work. Try again."` |  |
| `side` | `"top" \| "right" \| "bottom" \| "left"` | `"bottom"` |  |
| `align` | `"start" \| "center" \| "end"` | `"end"` |  |
| `open` | `boolean` |  |  |
| `defaultOpen` | `boolean` | `false` |  |
| `onOpenChange` | `(open: boolean) => void` |  |  |
| `container` | `HTMLElement \| React.RefObject<HTMLElement \| null> \| null` |  | Where the popover portals to. Pass an element to keep it inside a frame. |
| `className` | `string` |  |  |

## Install

One-time setup (needs a subscription):

1. Add the registry to the project's `components.json`: `{"@assembli":{"url":"https://www.assembli.design/r/{name}.json","headers":{"Authorization":"Bearer ${ASSEMBLI_API_KEY}"}}}` (merge into `"registries"`).
2. Put an API key from https://www.assembli.design/account in `.env.local` as `ASSEMBLI_API_KEY=asm_…`.

Then install with the shadcn CLI (writes `components/confirm-popover/confirm-popover.tsx` and installs dependencies):

```bash
npx shadcn@latest add @assembli/confirm-popover
```

Registry item JSON: https://www.assembli.design/r/confirm-popover.json (send `Authorization: Bearer <api key>`)

## Code

> Component source needs an Assembli subscription ($12/month or $96/year) and an API key sent as `Authorization: Bearer <key>`. To get one without copying anything, POST https://www.assembli.design/api/agent/login (or call the MCP tool connect_account), show the user the link it returns, and poll https://www.assembli.design/api/agent/token for the key. Or subscribe at https://www.assembli.design/pricing and create a key at https://www.assembli.design/account.
