Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Delete Account Dialog Block for React

A notes app's settings page with its account deletion shown open: an alert dialog in three numbered steps, what goes with a real data download, the email typed exactly, then the password and a 14-day grace switch.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Make the end of an account slow, clear and reversible for a while, with this three-step deletion for React with Base UI. It opens from the Settings page of Notehaven, a notes app: the header holds an outline Delete account Button, and the page itself, a tab strip, two settings and a framed danger cell, is drawn under a soft scrim inside a hairline frame with a plus mark on each corner. The Alert Dialog is numbered by the catalog Steps, which show their numbers only on a phone. Step one lists what goes in a Data List, the notes, the shared notebooks, the attachments and the plan, and offers Download my data, a real file made with a Download Trigger from typed sample data. Step two asks for the account's email, typed exactly, with a polite line that says Matches or Does not match. Step three asks for the password in a Password Input and has a Switch that keeps the account for 14 days in case of a change of mind, on by default and dated. Delete account is the catalog Button in its destructive variant, with no Shine Button in the block, and Cancel has focus when it opens. Confirming draws a "Deletion scheduled" banner on the page and turns the header's button into Cancel deletion. For preview the alert is drawn open in place when the page loads; the header button opens the real Alert Dialog, with the same steps and the same fields. For accounts, workspaces and anything with data a person may want back.

FAQ

Why is the alert already open, and what do I keep?

So you can see it without a click. On load the alert is a copy drawn in place over the page: a native dialog element with the alertdialog role that isn't modal, so nothing is trapped, hidden or focused, and the page around the preview keeps working. The Delete account button in the header opens the real Alert Dialog, modal, with its focus trap, Escape and focus on Cancel, and the copy stays closed until a reload. Both show the same WipeFields component and share the block's state, so what you typed in the copy is there in the real one. In your app keep the Alert Dialog and drop the copy: the "in-place" state, the scrim and the dialog element inside the frame.

How do the three steps work?

All three panes sit in one grid cell and only the current one is visible and reachable, so the dialog never changes height and Tab never reaches a hidden field. Continue is the catalog Button and stays quiet until its step is done; pressed too early it says what is missing and goes to that field. On the last step the same button becomes the destructive Delete account. Back returns a step, focus lands on each step's first control, and a polite message says which step you are on. Enter in a field does what the button does.

Is Download my data a real file?

Yes. It is a Download Trigger that saves notehaven-export.json, built in the browser from NOTEBOOKS, the same typed notebooks the first step's counts are summed from. It holds sample data, and a polite message says so. In your app point it at an endpoint that streams the person's real export, and say how long it takes if it is slow. Offer it before the person has to type anything, as the first step does.

What does Delete account do here, and how do I wire it up?

Here it deletes nothing. It closes the dialog, draws the banner with the date from AS_OF plus the grace days, turns the header's button into Cancel deletion, and says in a polite message that nothing was deleted. Cancel deletion takes the banner away. With the switch off, the banner says the deletion is scheduled for today. In your app verify the password and the typed email on your server, schedule the deletion there with the grace period, email the owner, and keep the dialog open with a busy state until your server answers.

Where does focus go, and how does it close?

The real alert is named by its title and described by its sentence, and it opens with focus on Cancel, never on the destructive action, so a stray Enter backs out. Escape and Cancel close it and return focus to the Delete account button; clicking outside does not close it, since an alert has to be answered. Cancel is the focus target through initialFocus. After a confirmed deletion the button that opened the alert is gone, so about 300 ms later focus moves to Cancel deletion, the button that took its place. The copy shown on load moves no focus; Escape inside it and Cancel close it the same way.

How does it look on a phone?

The copy shown on load docks to the foot of the frame as a bottom sheet with its actions pinned at the bottom, Back and Cancel side by side over a full-width Continue, and the step panes scroll above them. The numbers stand alone and their titles are read out only. The real alert keeps the Alert Dialog's own layout: a centred card as wide as the screen allows, scrolling inside itself if the screen is short.

  • Pro

    Confirm Delete Dialog

    Destructive confirms

    A planner's project list with its delete confirmation shown open: an alert dialog that lists what goes with the project, asks for its name to be typed exactly, and keeps Delete off until it matches.

  • Pro

    Cancel Subscription Dialog

    Destructive confirms

    A backup service's plan page with its exit flow shown open: an alert dialog in three steps, why you are leaving, an offer matched to the reason, and what ends and when, with a destructive final button and a thin progress bar.

  • Pro

    A usage-report tool's Exports page with its export dialog shown open: a CSV or JSON format, a range with row counts, six fields behind a mixed Select all box and a size estimate, and a Download button that saves a real file.

  • Pro

    Confirm Action Dialog

    Confirm and consent

    A newsletter editor with its publish confirmation shown open: an alert dialog that lists what happens to the issue, a box that remembers the answer, and a foot that gives the question back.

  • Pro

    Downgrade Confirmation Billing

    Upgrade and downgrade

    A downgrade that shows what it costs first: the limits that shrink, the folders now over the smaller plan's storage with a checkbox to archive each and a live meter, the day it takes effect, and an alert dialog that asks for a typed word.

  • Pro

    Deactivate 2FA Dialog

    Destructive confirms

    A security page with its turn-off confirmation shown open: an alert dialog that lists what goes with two-step verification, asks for the password and a ticked acknowledgement, and keeps its destructive action quiet until both are done.