Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Sheet examples · Settings

App Preferences Sheet for React

A right-side sheet of four app preferences, each a label with a checkbox at the end of the row.

Framework
UI library

Four on/off preferences in a right-side sheet: Enable Notifications, Share Analytics, Auto Update and Dark Mode. Each row is a horizontal Field, label at the start and checkbox at the end, so the label toggles the box. Only Auto Update starts checked.

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 preferences are in this sheet, and which start on?

Enable Notifications, Share Analytics, Auto Update and Dark Mode. Auto Update starts checked; the other three start unchecked.

Where does the checked state live?

Inside each Checkbox: they're uncontrolled, and the sheet has no save button, so nothing reads them. Make them controlled, or put them in a form, to send the values somewhere.

Why does this preferences sheet include 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 App Preferences, with Customize your app experience under it.

How does the Preferences button open the sheet?

The outline button labeled Preferences 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 are the rows laid out?

Each row is a Field with orientation="horizontal" and justify-between, so the label starts the row and the checkbox ends it, on either reading direction. The rows sit in a FieldGroup under SheetHeader.

How do I dismiss the preferences 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.