Skip to content
shadcn.io

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.

Framework
UI library

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

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

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.

Which edge does it use?

The right: SheetContent leaves side unset. Set side="left" to open it from the start of the page instead.