Popconfirm
NewA small "Are you sure?" bubble next to a button, for quick confirmations where a dialog is too much.
- feat/saved-views
- fix/proration
- chore/deps
Installation
$ pnpm dlx shadcn@latest add @synccn/popconfirmFirst time in this project? Connect synccn with one command.
Usage
import { Popconfirm } from "@/components/ui/popconfirm";<Popconfirm title="Delete this branch?" destructive onConfirm={remove}><Button>…</Button></Popconfirm>API reference
Generated from the component's TypeScript types, so it always matches the code.
Popconfirm
A small "Are you sure?" bubble next to the button, for quick, low-stakes confirmations where a full dialog would be too much. Focus starts on Cancel.
- childrenrequired
React.ReactElement<any>The button that asks.
- titlerequired
React.ReactNodeThe question, e.g. "Delete this branch?".
- description
React.ReactNodeWhat happens, in a sentence.
- confirmLabel
stringDefault
"Confirm"Label on the confirm button.
- cancelLabel
stringDefault
"Cancel"Label on the cancel button.
- destructive
booleanDefault
falseStyles the confirm button and icon as destructive.
- onConfirmrequired
() => unknownRuns on confirm. Return a promise to show a spinner until it settles.
- side
"top" | "bottom"Default
"top"Which side of the trigger it opens on.
- align
"start" | "center" | "end"Default
"center"Alignment with the trigger.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Components
- Popover for
Popover,PopoverContent,PopoverTrigger
Helpers
- lib/utilscn (merges class names)
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for AlertTriangle, Loader2
Keyboard
- EscClose without confirming
- TabMove between Cancel and Confirm
Accessibility
- Opens as an alertdialog with focus on Cancel, so Enter never confirms by accident.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: alertdialog
- ARIA attributes: aria-label