shadcn.io is not affiliated with official shadcn/ui
Dialog examples · Standard
Delete Confirmation Dialog for React
A delete account dialog whose delete button stays disabled until the reader types the confirmation phrase.
Deleting an account by accident is a disaster. This React dialog keeps Delete Account disabled until the reader types delete my account, which turns a click into a deliberate act. It's shadcn.io's Dialog on Base UI with a controlled Input in a Field.
Preview
Installation
FAQ
Should the match be case-sensitive?
The demo compares exactly. Compare lowercase versions if you'd rather accept Delete My Account too; keep exact matching for names that are case-sensitive in your system.
What phrase should people type?
Something specific: delete my account, or the name of the resource. Avoid yes or confirm, which are typed without thinking.
How is the button disabled?
The input is controlled, and the button takes disabled until its value equals the phrase.
How do I make the danger clear?
Use variant="destructive" on the trigger and the button, and say exactly what will be removed in DialogDescription.
Related
- Standard DialogA share dialog with a read-only link, a
- Simple Delete Confirmation Alert DialogA simple delete confirmation with a
- Input with LabelA text input with a label above it
- Button with Text (Destructive)Delete, in the danger color
- Terms and Conditions DialogA terms dialog whose I Agree button stays
- Simple Confirmation Dialog Alert DialogA simple confirmation dialog with Cancel