shadcn.io is not affiliated with official shadcn/ui
Danger Zone Settings Block for React
Three destructive actions that ask for more the harder they are to undo: Pause in one click, Archive behind an alert dialog, Delete behind a typed workspace name and a slide-to-confirm button, with a 14-day Restore.
Installation
Overview
Let admins do the worst things to a workspace without doing them by accident with this danger zone for React with Base UI. Three rows, each with a three-step meter and a few words that say how hard it is to take back. Pause is one click and reversible: the same button reads Resume once the workspace is paused. Archive makes the workspace read-only for everyone behind an Alert Dialog with focus on Cancel, and Unarchive takes the button's place afterwards. Delete shows what will go (projects, files and members) in a Data List, then asks in an alert dialog for the workspace's name, typed exactly, which unlocks a Slide to Confirm Button: drag its handle across, or focus it and press Enter. A scheduled deletion is recoverable for 14 days, so the row turns into Restore, and it quiets the other two rows until it is undone. One status line says what happened and that nothing was changed. It's built from Alert Dialog, Slide to Confirm Button, Data List, Input, Button and Guides, with a CSS entrance only. For any product where a team can pause, archive or delete a shared space.
FAQ
Why three different kinds of confirmation?
Because the cost of a mistake is different. Pausing is undone by one press, so it has no dialog. Archiving changes what everyone can do, so it asks once and says what happens. Deleting is the one that loses things, so it asks for the name typed out and then a deliberate gesture, and still leaves 14 days to change your mind. The meter and the words beside each title (One click, One confirmation, Type the name, then slide) say that up front.
How does the slide-to-confirm button work, and can I use a keyboard?
Until the name matches, the slot holds a quiet button that says Type the name to unlock and, pressed, moves focus to the field. When it matches, the Slide to Confirm Button takes its place: drag the handle across the track and release past nine tenths of it, or focus the button and press Enter or Space, which confirms without dragging. A click on the track alone does nothing. It mirrors in right-to-left layouts and the handle jumps instead of easing under reduced motion.
How do I fill it with my own workspace?
Edit WORKSPACE (the name to type), CONTENTS (what a deletion takes), MEMBERS and GRACE_DAYS. The date the deletion lands on is worked out from AS_OF, a fixed day, so the page reads the same every time; in your app use the real date from your server.
What stays local, and how do I make it real?
Everything. Pause, Archive and Delete only change what the page says; no member is signed out and nothing is removed. To make it real, send each result from togglePause, confirmArchive, confirmDelete and restore to your server, keep the 14-day hold there, and check on the server that the name was typed: the page's check is only a courtesy.
How does it work with a keyboard and a screen reader?
Both dialogs are alert dialogs: focus starts on Cancel, Escape closes them and focus returns to the button that opened them. When a button is replaced (Archive by Unarchive, Delete by Restore) focus moves to its replacement. The typed-name line is announced as you type, and the status line at the foot is the one live region for the results. Buttons that can't act while a deletion is scheduled stay focusable and say why when pressed.
Related
- Pro
Account Deletion Settings
Backups and exportsA whole-page account deletion that first asks what happens to each kind of data (delete, anonymise or transfer, with invoices locked for tax law), sums the choices in one sentence, then schedules deletion 14 days out behind a typed-email alert dialog.
- Pro
Transfer Ownership Settings
Team and rolesA three-step alert dialog for handing over a workspace, open over the members list: choose an admin, review the before and after of both roles, type the workspace name, then a pending state with Cancel transfer.
- Pro
Confirm Delete Dialog
Destructive confirmsA 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
Delete Account Dialog
Destructive confirmsA 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
Backup and Restore Settings
Backups and exportsA backups page with a list of six snapshots and the three-step restore that opens from it, shown open on load: choose what to bring back, read the impact and type the snapshot date to confirm, then watch a progress bar fill and end on a plain statement that nothing was restored in the demo.
- Pro
Audit Log Retention Settings
Backups and exportsAn audit log retention panel with a row for each class of event, a preset for how long to keep it, an archive-after menu, a legal hold that freezes the row and a two-part bar to one scale, with the gigabytes searchable and archived added up from typed daily volumes.