Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Sheet examples · Settings

Notification Preferences Sheet for React

A right-side sheet of notification settings, with email and push checkboxes grouped under their own headings.

Framework
UI library

Notification settings in two groups, Email Notifications and Push Notifications, each a FieldSet whose FieldLegend names its checkboxes. The legend gives screen readers the group as well as the row, so Mentions is heard as a push setting.

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

How are the notification options grouped?

Email Notifications holds Product Updates and Newsletter. Push Notifications holds New Messages and Mentions. Each group is a FieldSet with a FieldLegend and a FieldGroup of rows.

How is each checkbox named?

Each row is a horizontal Field: the FieldLabel at the start names the Checkbox at the end, and clicking the label toggles it. Newsletter is the only box that starts unchecked.

Is there a save button?

No. The checkboxes are uncontrolled and the sheet has no footer, so nothing reads them. Add a SheetFooter with a save button, and make the boxes controlled, to store the choices.

Why does this 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 Notification Settings, with Choose what notifications you want to receive as the description.

How does the Notifications button open it?

The outline button labeled Notifications 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.

Which edge does it open from?

The right: SheetContent leaves side unset. 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.