Skip to main content
ContainersLevel 2

Confirmation Dialog

二次确认框

WebMobileDesktopDifficulty: Medium

A dialog that carries state and a place in a multi-step flow, asking "are you sure?" before an action you might regret — unlike a plain modal that just displays information.

01

Live Demo

Actually clickable
Live Demo Playground
Hit "Delete photos" and the dialog stops you. Try Tab (focus is trapped inside) and Esc (to close).

What you just saw:Tapping "Delete photo" and getting "Delete 3 photos? They will move to Recently Deleted and be cleared after 30 days." with two buttons below: Cancel / Delete.

02

What it actually is

The value of a confirmation dialog is not interception, it is making the consequences legible. A good one names the specific impact (what gets deleted, whether it can be recovered) instead of a bare "Are you sure?" — the bare version only trains a conditioned reflex to click through.

confirmation dialogconfirm dialogare you suredestructive confirmstateful modalconfirmation modal
03

Anatomy · What it's made of

  1. Title标题

    Names the consequence, not "Alert"

  2. Impact影响说明

    "3 photos will be deleted"

  3. Cancel取消

    Holds focus by default

  4. Confirm确认

    A verb, in the danger color

04

When to Use

When it fits, and when it doesn't
Confirmation Dialog usage recommendations
SituationUse it?
The action is irreversible and high impactYes
A mis-tap is expensive (deleting data, closing an account, paying)Yes
A Snackbar undo is offered as an alternativeYes
The action is frequent and easily recoverable (clearing a text field)No
The action could just become an Undo instead of a gate (delete)Depends

If every action asks for confirmation, users learn to click the first button whenever a dialog appears.

If you can offer an Undo, do not gate the action — let users be brave and fast, then give them a way to change their mind.

05

Similar Patterns

Don't mix these up
06

How to tell AI

Three levels of prompt

Add the component name and specifics

Before deleting 3 photos, show a confirmation dialog: title "Delete 3 photos?", body "These photos will move to Recently Deleted and be cleared after 30 days.", Cancel holds focus by default, and the confirm button is red.

07

Don't just say this to AI

Bad → Better

Don't say this to AI

Show a confirmation dialog before deleting.

Say this instead

Show an alertdialog before deleting: title the consequence ("Delete 3 photos?") rather than "Are you sure?", put focus on "Cancel" by default, use a red verb "Delete" on the confirm button, and offer an undo via Snackbar after the action runs.

08

Share this card

Social-ready

Turn this pattern into a 3:4 or 1:1 knowledge card and export it as PNG right in the browser. No backend needed.