Skip to content
Back to skills

Takeoff Popconfirm

ASecurity

`Popconfirm` asks the user to confirm an action in a bubble next to the control that started it. Behavior is Spar's `Popconfirm` (a non-modal Popover with confirm / cancel actions and the pending state of an async `onConfirm`); the look is Takeoff's: `variant`, a status icon and Takeoff `Button`s. **When to use:** a quick, reversible action the user started on purpose (delete a row, discard a draft). Not this — a decision that needs a form, a long explanation or must block the page is a `Dial...

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 4, 2026
developmentreactapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 4, 2026

npx -y skills add turkishtechnology/takeoff-v2 --skill takeoff-popconfirm --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Takeoff Popconfirm?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Takeoff Popconfirm
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/turkishtechnology-takeoff-popconfirm/badge)](https://www.skillsdirectory.com/skills/turkishtechnology-takeoff-popconfirm)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: takeoff-popconfirm
description:
  'Build a Popconfirm (a small confirmation bubble anchored to the control that
  started an action, with cancel / confirm buttons and an optional async
  confirm) — the Popconfirm from @takeoff-ui/react-spar (Takeoff UI / Spar
  React). Trigger when asking "Are you sure?" before deleting a row, discarding
  a draft, resetting filters or any quick, reversible action; when a confirm
  must wait for a request (loading button); or when replacing window.confirm.
  Use this skill WHENEVER building, adding, importing, styling, or fixing a
  Popconfirm in a React app that uses @takeoff-ui/react-spar / Takeoff / Spar.
  Not for a blocking decision that needs more context — use Dialog there.'
---

# Popconfirm — @takeoff-ui/react-spar

`Popconfirm` asks the user to confirm an action in a bubble next to the control
that started it. Behavior is Spar's `Popconfirm` (a non-modal Popover with
confirm / cancel actions and the pending state of an async `onConfirm`); the
look is Takeoff's: `variant`, a status icon and Takeoff `Button`s.

**When to use:** a quick, reversible action the user started on purpose (delete
a row, discard a draft). Not this — a decision that needs a form, a long
explanation or must block the page is a `Dialog`; plain extra content on click
is a `Popover`.

## Setup

Requires the Takeoff provider + token CSS mounted once at the app root (see the
`takeoff-ui` skill or the installation docs). Then import:

```tsx
import { Popconfirm } from '@takeoff-ui/react-spar';
```

## Compound parts

- `Popconfirm` — root; state only, renders no DOM. Holds `open` / `defaultOpen`
  / `onOpenChange`, `disabled`, `onConfirm`, `onCancel`, `id`.
- `Popconfirm.Trigger` — the control that opens it (polymorphic; usually
  `as={Button}`).
- `Popconfirm.Content` — the panel (`role="alertdialog"`, portalled); holds
  `variant`, `side`, `align`.
- `Popconfirm.Icon` — optional decorative glyph; default per variant.
- `Popconfirm.Title` — the question; labels the panel.
- `Popconfirm.Description` — optional detail; describes the panel.
- `Popconfirm.Actions` — the right-aligned button row.
- `Popconfirm.Cancel` / `Popconfirm.Confirm` — small Takeoff Buttons (`No` /
  `Yes` by default) wired to `onCancel` / `onConfirm`.
- `Popconfirm.Arrow` — optional pointer; last child of the content.

## Basic usage

```tsx
<Popconfirm onConfirm={() => deleteRow(row.id)}>
  <Popconfirm.Trigger as={Button} variant="danger" appearance="text">
    Delete
  </Popconfirm.Trigger>
  <Popconfirm.Content>
    <Popconfirm.Icon />
    <Popconfirm.Title>Delete this row?</Popconfirm.Title>
    <Popconfirm.Description>This cannot be undone.</Popconfirm.Description>
    <Popconfirm.Actions>
      <Popconfirm.Cancel />
      <Popconfirm.Confirm />
    </Popconfirm.Actions>
    <Popconfirm.Arrow />
  </Popconfirm.Content>
</Popconfirm>
```

## Examples

### Async confirm (loading until the request settles)

Return a promise from `onConfirm`: the bubble stays open with a loading confirm
button, closes when it resolves and stays open when it rejects (show the error
yourself). Function children get `{ isPending }`.

```tsx
<Popconfirm
  onConfirm={async () => {
    try {
      await api.publish(id);
    } catch (error) {
      toast.error('Could not publish');
      throw error; // keep the bubble open
    }
  }}
>
  <Popconfirm.Trigger as={Button}>Publish</Popconfirm.Trigger>
  <Popconfirm.Content variant="info">
    <Popconfirm.Icon />
    <Popconfirm.Title>Publish the timetable?</Popconfirm.Title>
    <Popconfirm.Actions>
      <Popconfirm.Cancel>Not yet</Popconfirm.Cancel>
      <Popconfirm.Confirm>
        {({ isPending }) => (isPending ? 'Publishing' : 'Publish')}
      </Popconfirm.Confirm>
    </Popconfirm.Actions>
  </Popconfirm.Content>
</Popconfirm>
```

### Localised labels for the whole app

```tsx
<TakeoffSparProvider
  components={{
    PopconfirmCancel: { defaultProps: { children: 'Hayır' } },
    PopconfirmConfirm: { defaultProps: { children: 'Evet' } },
  }}
>
  <App />
</TakeoffSparProvider>
```

### Destructive confirm on a neutral bubble, no icon

```tsx
<Popconfirm.Content side="top" align="end">
  <Popconfirm.Title>Remove seat 14C?</Popconfirm.Title>
  <Popconfirm.Actions>
    <Popconfirm.Cancel>Keep</Popconfirm.Cancel>
    <Popconfirm.Confirm variant="danger">Remove</Popconfirm.Confirm>
  </Popconfirm.Actions>
</Popconfirm.Content>
```

## Key props

### `Popconfirm` (root)

| Prop           | Type                                 | Default | Notes                                                   |
| -------------- | ------------------------------------ | ------- | ------------------------------------------------------- |
| `onConfirm`    | `() => void \| PromiseLike<unknown>` | -       | Promise → pending until it settles; resolve closes.     |
| `onCancel`     | `() => void`                         | -       | Cancel button only (not Escape / outside press).        |
| `open`         | `boolean`                            | -       | Controlled open state.                                  |
| `defaultOpen`  | `boolean`                            | `false` | Uncontrolled initial state.                             |
| `onOpenChange` | `(open: boolean) => void`            | -       | Every open / close, including Escape and outside press. |
| `disabled`     | `boolean`                            | `false` | Disables the trigger.                                   |

### `Popconfirm.Content`

| Prop                                                                                | Type                                                                | Default    | Notes                                        |
| ----------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ---------- | -------------------------------------------- |
| `variant`                                                                           | `'white' \| 'dark' \| 'info' \| 'success' \| 'warning' \| 'danger'` | `'white'`  | Panel colour; sets icon and button defaults. |
| `side`                                                                              | `'top' \| 'right' \| 'bottom' \| 'left'`                            | `'bottom'` | Flips to stay on screen.                     |
| `align`                                                                             | `'start' \| 'center' \| 'end'`                                      | `'center'` |                                              |
| `container`                                                                         | `HTMLElement \| null`                                               | body       | Portal container.                            |
| `onEscapeKeyDown` / `onPointerDownOutside` / `onFocusOutside` / `onInteractOutside` | event callbacks                                                     | -          | `preventDefault()` keeps it open.            |
| `onOpenAutoFocus` / `onCloseAutoFocus`                                              | `(event: Event) => void`                                            | -          | `preventDefault()` skips the focus move.     |

`Popconfirm.Cancel` / `.Confirm`: `variant`, `appearance`, `startContent`,
`endContent` (Button's), children or `({ isPending }) => …`; a consumer
`onClick` runs first and `preventDefault()` vetoes the action.

Full props, events, data attributes & type definitions: see
`references/full-docs.md`.

## Accessibility

- The panel is a non-modal `alertdialog`, named by `Popconfirm.Title` and
  described by `Popconfirm.Description`. Without a title, give
  `Popconfirm.Content` an `aria-label`.
- Opening focuses the first button — keep `Cancel` before `Confirm` so Enter
  right after opening never confirms. Escape closes and returns focus to the
  trigger.
- The icon is `aria-hidden`; the pending confirm button is `aria-busy`.

## Reference

- Full component docs (Copy page): `references/full-docs.md`
- Live docs: https://v2.takeoffui.com/docs/components/popconfirm
- Source: `packages/react-spar/src/components/popconfirm/`
- Spar primitive: https://v2.takeoffui.com/headless/docs/Components/Popconfirm

Files in this skill

  • SKILL.md8.1 KB
  • references/full-docs.md25.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.