Dropdown menu
A focused list of actions anchored to a trigger.
Your account, settings, theme, and sign out behind the avatar. Opens as a bottom sheet on phones.
npx shadcn@latest add @silicon-ui/user-menunpx shadcn@latest add @silicon-ui/user-menuInstall the dependencies.
npm install lucide-react motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/user-menu/user-menu.tsxcomponents/silicon-ui/user-menu/user-menu.module.cssInstall the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation
UserMenu| Prop | Type | Default |
|---|---|---|
user* | UserMenuUser | — |
statusPresence status. Passing `status` or `onStatusChange` shows the presence dot and an inline status switch. | UserStatus
| — |
defaultStatus | UserStatus
| "available" |
onStatusChange | (status: UserStatus) => void | — |
theme | ThemePreference
| — |
defaultTheme | ThemePreference
| "system" |
onThemeChangeReports the choice. Applying it to the page is up to the app. | (theme: ThemePreference) => void | — |
showThemeShows the inline light, dark, and system switch. | boolean | true |
itemsAccount destinations with optional shortcut hints, such as ["⌘", ","]. Keep it to three or four. | UserMenuItem[] | [] |
onSignOut | () => void | Promise<unknown> | — |
signOutKeys | string[] | — |
align | "start" | "center" | "end" | "end" |
showNameShows the name and a chevron beside the avatar from 640px up. | boolean | false |
open | boolean | — |
defaultOpen | boolean | false |
onOpenChange | (open: boolean) => void | — |
portalRenders the desktop panel in a portal on the body. Pass false to keep it inside the trigger's wrapper. | boolean | true |
refThe trigger button, for returning focus after the menu is swapped out. | Ref<HTMLButtonElement> | — |
className | string | — |
PresenceDot| Prop | Type | Default |
|---|---|---|
status* | UserStatus | "offline" | — |
className | string | — |