Components · Feedback
Popconfirm
A lightweight inline confirmation popover anchored to the trigger — confirm/cancel a low-risk action.
Examples
<!-- Paste-and-run: save as .html and open in a browser. No build step, no bundler.
Popconfirm is a COMPOSITE (antd, no framework-free element), so its HTML form is a
CDN-React page — React + antd load from a CDN (esm.sh) and mount on open. It consumes
the SAME shared `popconfirmTheme` the React/Vue wrappers use, so it renders the DS V3
look (radius-8 popover, primary confirm, #E3E3E3 cancel border). No JSX — React.createElement. -->
<div id="root"></div>
<script type="module">
import React from 'https://esm.sh/react@18';
import { createRoot } from 'https://esm.sh/react-dom@18/client';
import { ConfigProvider, Popconfirm, Button } from 'https://esm.sh/antd@6?deps=react@18,react-dom@18';
import { popconfirmTheme } from 'https://cdn.jsdelivr.net/gh/ahaslides-product/ahaslides-design@master/lib/popconfirm-theme.js';
const h = React.createElement;
createRoot(document.getElementById('root')).render(
h(ConfigProvider, { theme: popconfirmTheme },
h(Popconfirm, {
title: 'Delete this slide?',
description: 'This cannot be undone.',
okText: 'Delete', cancelText: 'Cancel',
placement: 'top', // top | bottom | left | right
okType: 'danger', // 'primary' (purple) default; 'danger' = red confirm
onConfirm: () => console.log('confirmed'),
}, h(Button, { danger: true }, 'Delete slide'))
)
);
</script>
import { ConfigProvider, Popconfirm, Button } from 'antd'; // antd v6
import { popconfirmTheme } from '@ahaslides-product/design/popconfirm-theme';
<ConfigProvider theme={popconfirmTheme}>
<Popconfirm
title="Delete this slide?"
description="This cannot be undone."
okText="Delete"
cancelText="Cancel"
placement="top" // top | bottom | left | right — arrow tracks the trigger
okType="danger" // "primary" (purple) by default; "danger" = red confirm
onConfirm={remove}
>
<Button danger>Delete slide</Button>
</Popconfirm>
</ConfigProvider>
// One shared popconfirmTheme → the DS V3 look; primary confirm, #E3E3E3 cancel border.
// Matrix: placement (top/bottom/left/right) × okType (primary/danger).
// For a destructive/irreversible action use a Modal instead (overlays pattern).
<script setup>
import { ConfigProvider, Popconfirm, Button } from 'ant-design-vue'; // ant-design-vue v4
import { popconfirmTheme } from '@ahaslides-product/design/popconfirm-theme';
function remove() { /* delete the slide */ }
</script>
<template>
<a-config-provider :theme="popconfirmTheme">
<a-popconfirm
title="Delete this slide?"
description="This cannot be undone."
ok-text="Delete"
cancel-text="Cancel"
placement="top"
ok-type="danger"
@confirm="remove"
>
<a-button danger>Delete slide</a-button>
</a-popconfirm>
</a-config-provider>
</template>
<!-- The SAME popconfirmTheme as React → one DS V3 look across both vendor libraries. -->
<!-- Matrix: placement (top/bottom/left/right) × ok-type (primary/danger). -->
// @ahaslides-product/design/popconfirm-theme — declared ONCE, consumed by both tiers.
import { popconfirmTheme } from '@ahaslides-product/design/popconfirm-theme';
export const popconfirmTheme = {
token: {
colorPrimary: '#6A1EBB',
borderRadius: 8,
borderRadiusLG: 8,
controlHeight: 32,
colorBorder: '#E3E3E3',
colorText: '#1A1A1A',
colorTextHeading: '#1A1A1A',
colorWarning: '#FF7747',
colorBgElevated: '#FFFFFF',
fontFamily: 'var(--aha-font-product, "Plus Jakarta Sans", sans-serif)',
},
components: {
Popover: { borderRadiusLG: 8, colorBgElevated: '#FFFFFF' },
Button: { borderRadius: 8, controlHeight: 32 },
},
};
API
| Prop | Type | Default | Notes |
|---|---|---|---|
title | string | — | The confirmation question |
description | string | — | Optional supporting line |
okText | string | OK | Confirm button label |
cancelText | string | Cancel | Cancel button label |
onConfirm | () => void | — | Fires when the confirm button is clicked |
placement | 'top' | 'bottom' | 'left' | 'right' | … | top | Where the popover opens relative to the trigger |
okType | 'primary' | 'danger' | primary | danger styles the confirm as a red destructive button |
icon | ReactNode | warning | Leading warning glyph in the popover header |
Install
# .npmrc — once: point the @ahaslides-product scope at GitHub Packages
@ahaslides-product:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN} # a GitHub token with read:packages
npm i @ahaslides-product/design
import '@ahaslides-product/design/tokens.css'; // once, at the app root
import '@ahaslides-product/design/popconfirm-theme'; // registers <popconfirm>
Agent feed for this component (absolute, fetchable anywhere): popconfirm.agent.json · popconfirm.md · popconfirm.llms.txt
When to use
When to use
- Popconfirm — a low-risk, reversible action needs a quick inline check (delete a row, discard a draft)
- Modal — a destructive or irreversible action needs a deliberate, focused confirmation
- no confirm — the action is trivial and easily undone — prefer an undo toast
Reserve Popconfirm for low-risk, reversible actions — anchor it to the trigger and keep the question to one line. A destructive or irreversible action (delete account, publish) needs a Modal (see the overlays pattern), never a popover.
Surfaces
editor dashboard settings
Spec
Popover white · radius 8 · elevated · Confirm primary Button #6A1EBB · white label · Cancel default Button · 1px #E3E3E3 border · #1A1A1A label · Title #1A1A1A, one short question · Anchor pops from the trigger; not a full modal · Placement top · bottom · left · right (arrow tracks the trigger) · Danger okType="danger" → red confirm #F5222D for a heavier delete