Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Cancel Subscription Dialog Block for React

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.

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

Let people leave without a fight, and with a fair chance to stay, with this exit flow for React with Base UI. It opens from the Plan page of Archivale, a cloud-backup service: the header holds an outline Cancel plan Button, and the page itself, a tab strip over the plan card and its usage bars, is drawn under a soft scrim inside a hairline frame with a plus mark on each corner. The Alert Dialog shows its place with a thin Progress bar and the words "Step 2 of 3". Step one asks why in a Radio Group: too expensive, not using it enough, a missing feature, switching, or another reason. Step two answers the reason: stay for $4 a month, pause for one to three months with a Native Select, say what is missing in a Textarea, export everything first with a Download Trigger, or nothing for another reason. Step three lists what ends and when; its action is the catalog Button in its destructive variant, and Keep plan, the alert's Cancel, has focus when it opens. Earlier steps use the Shine Button. The drawn plan card says what happened: ends on a date, paused until a date, or the offer's price. 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 choices.

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 Cancel plan button opens the real Alert Dialog, modal, with its focus trap, Escape and focus on Keep plan, and the copy stays closed until a reload. Both show the same ExitFields component and share the block's state, so what you chose 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 is the offer matched to the reason?

Every pane sits in one grid cell and only the one for the chosen reason shows, so the alert never changes height and Tab never reaches a hidden field. Too expensive offers $4 a month for three months, and its button takes the offer and closes; not using it enough offers a pause of one, two or three months, with the resume date in the line under the select; a missing feature asks what is missing and goes on; switching offers a real export first; another reason offers nothing and says so. A quiet "No thanks, continue" skips the offer. The offers and the dates come from typed constants and AS_OF, never from the clock.

Is the export a real file?

Yes. Download export is a Download Trigger that saves archivale-export.json, built in the browser from typed sample folders, and a polite message says it holds sample data. 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. It sits before the last step because a person who is leaving should be able to take their files with them first.

Why is the last button not a Shine Button?

Because it ends something. On the last step the forward button becomes the catalog Button in its destructive variant, with its text mixed toward the foreground colour so it keeps its contrast on the tint in both themes, and the block has no Shine Button on that step. Keep plan stays the safe, focused choice, Back returns a step, and clicking outside never closes the alert. Nothing is cancelled here: the drawn plan card says "Ends Nov 14, 2026 (cancelled in this demo)" and the header button becomes Restore plan.

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 Keep plan, so a stray Enter backs out. Each step puts focus on its first control and a polite message says which step you are on; Enter in a field does what the forward button does. Escape and Keep plan close it and return focus to Cancel plan. Keep plan is the focus target through initialFocus. After a confirmed choice the button that opened the alert is gone, so about 300 ms later focus moves to Restore plan.

What stays local in the demo, and how do I wire it up?

All of it. No plan is cancelled, paused or charged: the choice updates the drawn plan card and says in a polite message that nothing was cancelled or charged, and Restore plan puts it back. In your app send the reason and the choice to your billing provider in submit, show its answer in the alert before you close it, and keep the reason for your own churn report; end the plan at the period's end, as the last step promises, not at once.

  • Pro

    Delete Account Dialog

    Destructive confirms

    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.

  • 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

    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

    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

    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.

  • Pro

    Feedback Rating Dialog

    Feedback and reports

    A help desk's ended chat with a one-tap satisfaction dialog shown open: five drawn faces from very bad to great that record the score at once, then an optional comment with a question that fits the score.