Skip to content
IndexRequest a UIAboutContact

Inline Confirm Button

A destructive button that asks for a second press in place, turns red, and resets itself after a few seconds.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Clean UI mockup showing the same button in three states side by side, a neutral outlined Delete project button, the same button turned solid red reading Click again to confirm with a thin white countdown bar shrinking along the bottom edge, and a final grey state reading Project deleted with a small checkmark, light theme, flat modern style, the three buttons the same width. Negative: modal dialogs, heavy shadows, text errors, clutter. Reduced motion: static design.

About this pattern

Definition

An inline confirm button avoids a modal for low-stakes destructive actions. The first press changes the label to Confirm and the colour to red; a second press performs the action. If nothing happens for a few seconds, it resets, so the risky state never lingers.

Purpose & UX principles

  • First press: change the label and colour, move focus to stay on the button, announce the change.
  • Second press: do the action.
  • Reset after about 3 seconds, on blur or on Escape.
  • Keep the button width stable so the layout does not jump.

Interaction states

  • One button with states: idle, confirm, done; a Reset demo button.

Motion specification

  • The colour change takes 150ms; a thin bar shows the reset countdown.
  • Reduced motion: no countdown bar animation and no transition.

Responsive behaviour

  • Use it for reversible or low-impact actions; use a dialog or type-to-confirm for serious ones.
  • Announce Are you sure to screen readers with a live region.

Code

HTML
<div class="bx"><div class="rw0"><button class="cb" id="cb" type="button" data-s="0"><span id="cl">Delete project</span><i></i></button></div><p class="out" id="out" role="status"></p><button class="mini" id="rs" type="button">Reset demo</button></div>

Related patterns

Type-to-Confirm Delete

↗
Type-to-Confirm DeleteOverlays & Dialogs

Hold to Delete Button

↗
Hold to Delete ButtonButtons & Actions

Loading Button States

↗
Loading Button StatesButtons & Actions