This page as markdown: /confirm-button.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

ConfirmButton

Status: stable

An inline two-step confirm for a low-stakes destructive or irreversible action: the first press arms it ("Delete" → "Confirm delete?", destructive), a second press within a few seconds runs it, and leaving it disarms it.

Keywords: confirm, confirmation, two-step, press again, click again, arm, delete, remove, destructive, inline confirm, hold to confirm

Usage

Use ConfirmButton when an action deserves one beat of second thought but not a modal: deleting a draft, removing a row, revoking one token, clearing a list that can be rebuilt. The question appears on the button the user is already pressing, so confirming costs one more press in the same place and backing out costs nothing.

Best practices

Props

Name Type Default Description
children ReactNode — The idle label — the action, e.g. "Delete".
confirmLabel ReactNode "Confirm The label while armed. Defaults to "Confirm delete?" for a text label "Delete" (first letter lowered) and "Confirm?" otherwise. Pass it to localise.
onConfirm () => unknown — Runs on the second press while armed. Return a promise to hold the button armed with a spinner until it settles.
timeout number 3000 How long it waits for the second press, in ms. A decision time, so it is not scaled by motion settings.
variant ButtonVariant "secondary" The idle look — any Button variant.
confirmVariant ButtonVariant "destructive" The armed look — any Button variant.
size "xs" | "sm" | "md" | "cta" "md" A labelled Button size. Icon-only sizes are excluded: the label is the interaction.
icon ReactNode — A leading icon kept through both states, e.g. <Icon name="trash" />.
disabled boolean false Disables it; disabling while armed also disarms.
confirmHint string "Press again to confirm." Read to assistive tech after the armed label when it arms. Override to localise.
motion "full" | "subtle" | "off" "full" How much motion this component uses: full (default) inherits the app's policy, subtle keeps feedback and drops the flourish, off stills it. It can only turn motion down — it never overrides a reader's reduce-motion setting. The width easing and the draining countdown are the flourish; the label cross-fade and colour change stay.

Variants

Tokens used

secondary, secondary-foreground, destructive, destructive-foreground, ring

Motion

Accessibility

Related

Examples

Delete a row

import { ConfirmButton, Icon } from "@sableui/react"

<ConfirmButton icon={<Icon name="trash" />} onConfirm={() => removeRow(id)}>Delete</ConfirmButton>

Custom question, longer wait

import { ConfirmButton } from "@sableui/react"

<ConfirmButton variant="ghost" size="sm" confirmLabel="Revoke this key?" timeout={5000} onConfirm={revokeKey}>Revoke</ConfirmButton>

Async confirm

import { ConfirmButton } from "@sableui/react"

<ConfirmButton onConfirm={() => api.deleteDraft(draft.id)}>Discard draft</ConfirmButton>