shadcn.io is not affiliated with official shadcn/ui
Dropdown Menu examples · Profile
Profile with Preferences Dropdown Menu for React
A profile menu with Profile and Settings links and three preference toggles you can flip from the menu.
Some settings get flipped often enough to deserve a shortcut. This dropdown menu opens from the avatar and puts Email Notifications, Push Notifications and Auto-save as checkbox rows under a Quick Preferences label, between the Profile and Settings links and a destructive Log out. It fits apps where people toggle the same few settings every day.
Preview
Installation
FAQ
Which quick preferences start on?
Email Notifications and Auto-save start checked; Push Notifications starts off. Each row keeps its own state, so any of them can be on together.
Each DropdownMenuCheckboxItem takes checked and onCheckedChange, which receives a boolean.
What are the rows that are not checkboxes?
Profile and Settings, under the header, and Log out at the end with variant="destructive". They're plain items with an aria-hidden icon each.
What is the trigger?
A round ghost Button (pill, size="icon-lg") holding the user's Avatar, with aria-label set to Open account menu.
What is in the header, and where does the menu open?
A DropdownMenuLabel with the name, shadcn, over m@example.com. The menu is w-64 and lines up with the end of the avatar button, since the avatar usually sits at the end of a navbar.
Related
- Profile Dropdown with Avatar Dropdown MenuA profile menu opened from a round avatar
- Profile Dropdown with Status Dropdown MenuA profile menu whose avatar shows an
- Account Settings Dropdown Dropdown MenuAn account menu opened from the user's
- Preferences Dropdown Dropdown MenuAn editor preferences menu of five
- Default SwitchA switch in its default off state, with
- Simple CheckboxA checkbox with a label for a single