Skip to content
synccn

Popconfirm

New

A 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/popconfirm

First 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.ReactNode

    The question, e.g. "Delete this branch?".

  • description
    React.ReactNode

    What happens, in a sentence.

  • confirmLabel
    string

    Default "Confirm"

    Label on the confirm button.

  • cancelLabel
    string

    Default "Cancel"

    Label on the cancel button.

  • destructive
    boolean

    Default false

    Styles the confirm button and icon as destructive.

  • onConfirmrequired
    () => unknown

    Runs 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

npm packages

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