User menu
Your account, settings, theme, and sign out behind the avatar. Opens as a bottom sheet on phones.
npx shadcn@latest add @silicon-ui/user-menuInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/user-menuManually
Install the dependencies
npm install lucide-react motionCopy these files into your project
- components/silicon-ui/user-menu/user-menu.tsx
- components/silicon-ui/user-menu/user-menu.module.css
Shared with other components. Skip any you already have.
- components/silicon-ui/lib/fluid-hover.tsx
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
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 (at every width with `fullWidth`). | boolean | false |
triggerSizeExperimental. The trigger's height: `md` (default) a 40px pill with a 32px photo; `sm` a 32px row with a 24px photo. | "sm" | "md" | "md" |
fullWidthExperimental. A sidebar's account row, as Silicon Accounts draws it: the trigger fills its container with the nav rows' corner, the photo a rounded square, the name taking the room (not capped), up-down chevrons at the end. The name and chevrons stay under 640px. Use with `showName`, `triggerSize="sm"` and `side="top"`. | boolean | false |
open | boolean | — |
defaultOpen | boolean | false |
onOpenChange | (open: boolean) => void | — |
accountsExperimental. Every account signed in on this browser, the current one included. The menu lists them as a choice (photo, name, handle and org, a tick on the current one) in place of the identity header. | UserMenuAccount[] | — |
currentAccountIdExperimental. The `accounts` entry that is signed in now. | string | — |
onSwitchExperimental. Called with another account's id when it is chosen; the menu closes first. | (accountId: string) => void | — |
onAddAccountExperimental. Shows "Add another account" under the accounts. | () => void | — |
onManageAccountsExperimental. Shows "Your accounts" under the accounts. | () => void | — |
accountLabelsExperimental. Words for the two account lines. | { add?: string; manage?: string } | — |
sideExperimental. Where the panel opens: by default below, or above when there is no room; `top` always above (a sidebar's foot). | "auto" | "top" | "auto" |
presentationExperimental. `list` draws no trigger and no popup: the accounts and actions are rows in place, for a phone sheet that already holds the sidebar. Status and theme switches are left out there. | "menu" | "list" | "menu" |
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 | — |
Dependencies
- npm
- lucide-reactmotion
- Registry
- silicon-motion-tokens