shadcn.io is not affiliated with official shadcn/ui
Cancel Retention Billing Block for React
A cancel flow in three steps: a reason picker, an offer that matches it (half off for three months, or a pause), and a last page with the exact end date, each step taking focus and every outcome ending on a confirmation.
Installation
Overview
Handle cancellations honestly and keep the customers you can, with this cancel flow for React with Base UI. A hairline frame with a plus mark on each corner holds Steps: Reason, Offer and Confirm. The first asks why they're leaving as choice cards in a Radio Group, with an optional Textarea. The second makes an offer that answers the reason: half off for three months, with the saving and the day the full price returns, or a one-month pause. The third states the day access ends, the final charge and how long their data is kept, with Back, "Keep my membership" and the cancel button. Every way out ends on a confirmation: discount applied, paused, staying, or cancelled with an "Undo cancellation" button. Each step's heading takes focus when you move. For subscription apps, fitness and learning products and media services.
FAQ
How do I fill it from my billing provider?
ACCOUNT at the top of the file holds the plan name, its monthly price in cents and paidThrough, the last day of what's paid for, as an ISO date. DISCOUNT holds the offer's percent and months. REASONS lists the choices, each with the offer it leads to, discount or pause. The reduced price, the saving and the day the full price returns are worked out from these, in whole cents. OUTCOMES holds the text of each ending. Wire the buttons that finish the flow to your discount, pause and cancel calls in finish.
How is the offer chosen?
By the reason. Price, a missing feature and switching to another app lead to the discount; not using it enough and taking a break lead to the pause. Change the offer of any reason in REASONS, or add a third offer type by adding a branch to the offer step. The offer never blocks the way out: "No thanks, continue" goes straight to the last step, and Back returns to change the reason.
How does focus work between steps?
Nothing takes focus on load. After the person moves, with Continue, Back, a step in the list or one of the finishing buttons, focus goes to the new heading and a polite live region says "Step 2 of 3: Offer" or the outcome's title. The heading is focusable by script only, so it isn't an extra tab stop. The step list is a single tab stop with arrow keys, and steps ahead of the furthest one reached are disabled.
Can a cancellation be undone?
Yes, from the confirmation: "Undo cancellation" replaces the outcome with "You're staying", moves focus to its heading, and tells you the next payment and its date. Wire it to your call that removes the scheduled cancellation. The flow itself never deletes anything: the last step says access runs to the paid-through date and that data is kept for 90 days.
Where do the links go?
"Keep my plan" on the first step and "Back to billing" on the confirmations are links to your billing settings. Each is a Button with render set to an a element and nativeButton={false}. Only one button is the primary at a time: Continue on the first step, the Shine Button offer on the second, and the cancel button on the third.
What does a screen reader hear?
The section starts with an h2 and each step is an h3. The reasons are a radio group named by the step's heading, and arrow keys move between them without advancing, since only Continue does. The textarea has its own label and is optional. The dates sit in time elements inside description lists, so each is read with its label.
Related
- Pro
Pause Subscription Billing
Upsell and retentionPause instead of cancelling: one, two or three months as choice cards, the resume date and first charge worked out, a timeline that grows with the choice, what stays available while paused, and one button that pauses and resumes.
- Pro
Downgrade Confirmation Billing
Upgrade and downgradeA 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
Current Plan Billing
Plan and usageThe account's current plan in app settings: plan, price, renewal date and card, a change-plan action, every quota's usage this period on shared hairlines, and the next invoice.
- Pro
Upgrade Proration Billing
Upgrade and downgradeChanging plan inside app settings with the bill worked out first: pick a higher plan and the credit for unused days, the new plan's cost for those days, what's due today and the next invoice roll live, then an alert dialog confirms the charge.
- Pro
Pricing With Guarantee
Proof and guaranteesA free trial with a refund window drawn as a timeline: today, day 12, day 14 and day 30 on one line, beside the yearly plan, its price and call to action. It turns vertical on a phone.
- Pro
Limit Reached Billing
Upsell and retentionThe upgrade prompt shown where someone hits a plan limit: what was blocked, the limit reached against the next plan's, a two-column comparison and Upgrade or Remind me later.