ComponentsFeedback & overlays
Confirm button
A destructive action in two presses: the first arms it and says what will happen, the second runs it.
- Domain
- Feedback & overlays
- Support level
- Size
- 4.5 kB gzip, budget 4.0 kB
- Who uses it
- 5 files of the live products and sites import it (Verikora: 1, Folioviv: 3, Sovkora: 1) Counted in the dated inventory of 2026-11-23.
import { ConfirmButton } from "@krizaka/ui/confirm-button";Web only — React, from @krizaka/ui/confirm-button. Beta: its API may still change in a minor version.
- Mobile · ✗ to build. A destructive action confirmed in place: no phone screen needs it yet beyond SwipeableRow. issue #276
Why it is here. Used by Sovkora, Verikora, Folioviv.
When to use
- For a destructive action on one item, in place: delete a comment, remove a member, leave a group.
- When a dialog would be too heavy and an undo is not possible.
When not to use
Installation
Install
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Import
import { ConfirmButton } from "@krizaka/ui/confirm-button";Examples
Icon, idle
An icon named by label.
Armed
After the first press: the danger border and tint, the words legible.
With words
Once armed, armedContent replaces the words.
Props
A two-step button: press to arm, press again within timeoutMs to confirm. State: data-armed.
| Prop | Type | Default | Description |
|---|---|---|---|
confirmLabelrequired | string | — | What the second press does, in words — shown and announced once armed ("Delete for good?"). Passed translated. |
onConfirmrequired | () => void | — | Runs on the second press. |
announce | string | — | A message announced politely by assistive technology when it changes (“Saved”, “Upload failed”) — passed translated. |
armedContent | ReactNode | — | What it shows once armed (default: its children, then confirmLabel). |
indicator | boolean | true | Shows the glyph while loading / with a status. false: you draw your own. |
label | string | — | The accessible name while idle, for an icon-only button (the confirm label names it once armed). |
loading | boolean | — | Disables and signals the wait (aria-busy, data-loading) and shows the Krizaka loader glyph before the label; the button keeps its colour. |
magnetic | boolean | — | @deprecated Since 3.31 (krizaka-ui#393): does nothing — a button never moves under the pointer. Removed in 4.0. |
onArmedChange | ((armed: boolean) => void) | — | Notified when it arms and disarms. |
progress | number | null | — | Between 0 and 1, while loading: the glyph's trace and a light fill across the button grow to the value (an
upload, an export). |
shape | "rounded" | "pill" | "cut" | rounded | rounded (an 8 px radius, the radius of a field) · pill. cut is deprecated (krizaka-ui#393: the chamfer is
retired) — it draws rounded and warns in development; it will be removed in 4.0. |
shimmer | boolean | — | @deprecated Since 3.31 (krizaka-ui#393): does nothing — the hover is quiet. Removed in 4.0. |
size | "sm" | "lg" | "icon" | "md" | md | sm · md · lg, or icon (a square). |
status | "success" | "error" | null | — | How the action ended: success draws a check, error a cross (and the button shakes its head once); a ring of
the status colour opens around it. Clear it to return to rest. |
timeoutMs | number | 4000 | Disarms after this many milliseconds (4000 by default). |
variant | "danger" | "primary" | "gradient" | "secondary" | "outline" | "ghost" | ghost | The look: primary (the accent), gradient (accent → accent-2), secondary (a raised surface), outline,
ghost, danger. |
Accessibility
- Once armed,
confirmLabelnames the button and is announced politely. - An icon-only confirm button needs
labelwhile idle. - The armed state is
data-armed: style it with the danger tint, the words stay a text role.
Keyboard
| Keys | Action |
|---|---|
| Enter / Space | Arms, then confirms. |
| Esc | Disarms; so does moving the focus away. |
Best practices
confirmLabelsays the consequence as a question: “Delete for good?”.- Keep
timeoutMsshort (4 s by default): an armed button left on screen is a trap. - Never use
window.confirmfor this.
Related components
Generated from the code of @krizaka/ui 5.3.4: its meta.ts, its examples and its types.Edit this documentation on GitHub