shadcn.io is an independent project built on shadcn/ui
A right panel titled Settings, with the line Manage your preferences. Switches sit under Notifications and Privacy, and Save Changes and Cancel sit at the bottom.
Use it for a few preferences beside the page on a phone. A long settings form belongs on its own page, not in a Sheet. In React, Base UI does not save the switches.
Installation
Anatomy

Usage
<Drawer swipeDirection="right">
<DrawerTrigger
render={
<Button aria-label="Open settings" size="icon-md" variant="outline" />
}
>
<SettingsIcon aria-hidden="true" />
</DrawerTrigger>
<DrawerContent>
<DrawerHeader>
<DrawerTitle>Settings</DrawerTitle>
<DrawerDescription>Manage your preferences</DrawerDescription>
</DrawerHeader>
<div className="flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-4">
<FieldSet>
<FieldLegend variant="label">Notifications</FieldLegend>
<FieldGroup className="gap-3">
<Field orientation="horizontal">
<FieldLabel className="font-normal" htmlFor="settings-email">
Email notifications
</FieldLabel>
<Switch id="settings-email" />
</Field>
<Field orientation="horizontal">
<FieldLabel className="font-normal" htmlFor="settings-push">
Push notifications
</FieldLabel>
<Switch defaultChecked id="settings-push" />
</Field>
<Field orientation="horizontal">
<FieldLabel className="font-normal" htmlFor="settings-sms">
{/* The rest of the file is under Installation. */}FAQ
How are the settings grouped?
Two FieldSets with a FieldLegend each: Notifications, with Email, Push and SMS, and Privacy, with Profile visible and Show activity.
Which switches start on?
Push notifications, Profile visible and Show activity. Email and SMS notifications start off.
How is each switch labeled?
Each row is a horizontal Field: the FieldLabel at the start names the Switch at the end, and clicking the label flips it.
Does Save Changes store the settings?
Not yet: the switches are uncontrolled and Save Changes has no handler. Control the switches, save on press, and close the drawer once it's stored:
Pass open to Drawer; onOpenChange receives the next boolean.
API Reference
Drawer
Sets swipeDirection="right". The rest is on the Drawer page.
Button
Sets aria-label="Open settings", size="icon-md" and variant="outline". The rest is on the Button page.
Field
Sets variant="label", orientation="horizontal", htmlFor="settings-email", htmlFor="settings-push", htmlFor="settings-sms" and htmlFor="settings-profile-visible". The rest is on the Field page.
Switch
Sets id="settings-email", defaultChecked, id="settings-push", id="settings-sms", id="settings-profile-visible" and id="settings-show-activity". The rest is on the Switch page.





