shadcn.io is not affiliated with official shadcn/ui
Sheet examples · Settings
Privacy Settings Sheet for React
A right-side sheet of privacy checkboxes, with a destructive Delete Account button under them.
Four privacy checkboxes and a destructive Delete Account button in a right-side sheet. The rows are horizontal Fields with the label first; the button uses variant="destructive" so the one irreversible action stands apart. Confirm it in an Alert Dialog before deleting anything.
Preview
Installation
FAQ
Which privacy boxes start checked?
Public Profile, Allow Search Indexing and Show Activity Status start checked. Show Email Address starts unchecked.
What does Delete Account do in this demo?
Nothing yet: it's a full-width Button with variant="destructive" and no handler. Open a confirmation from it before you call your API, since the action can't be undone.
Why is Privacy Settings a SheetTitle?
SheetTitle names the dialog for assistive tech, so every sheet renders one; hide it with sr-only when the design has no visible heading. It reads Privacy Settings, and the description reads Control your privacy and data preferences.
How does the Privacy button open the sheet?
The outline button labeled Privacy is the trigger, and its text is the accessible name.
The Button goes in the render prop of SheetTrigger, and the label stays its child.
How do I close the privacy sheet?
The corner close button is on because showCloseButton defaults to true. Escape and a click on the overlay close the sheet too, and focus goes back to the trigger. To close it from your own code, for example after the account is deleted, control the open state:
Pass open to Sheet; onOpenChange receives the next boolean.
Related
- App Preferences SheetA right-side sheet of four app
- Account Settings SheetA right-side sheet for changing the
- Notification Preferences SheetA right-side sheet of notification
- Button with Text (Destructive)Delete, in the danger color
- Simple Delete Confirmation Alert DialogA simple delete confirmation with a
- Simple CheckboxA checkbox with a label for a single