Skip to content

User menu

Your account, settings, theme, and sign out behind the avatar. Opens as a bottom sheet on phones.

MotionProduct
npx shadcn@latest add @silicon-ui/user-menu

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/user-menu

Manually

  1. Install the dependencies

    npm install lucide-react motion
  2. Copy 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
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { UserMenu } from "@/components/silicon-ui/user-menu/user-menu";

API reference

UserMenu

PropTypeDefault
user*UserMenuUser—
status

Presence status. Passing `status` or `onStatusChange` shows the presence dot and an inline status switch.

UserStatus

"available""busy""away"

—
defaultStatusUserStatus

"available""busy""away"

"available"
onStatusChange(status: UserStatus) => void—
themeThemePreference

"light""dark""system"

—
defaultThemeThemePreference

"light""dark""system"

"system"
onThemeChange

Reports the choice. Applying it to the page is up to the app.

(theme: ThemePreference) => void—
showTheme

Shows the inline light, dark, and system switch.

booleantrue
items

Account destinations with optional shortcut hints, such as ["⌘", ","]. Keep it to three or four.

UserMenuItem[][]
onSignOut() => void | Promise<unknown>—
signOutKeysstring[]—
align"start" | "center" | "end""end"
showName

Shows the name and a chevron beside the avatar from 640px up (at every width with `fullWidth`).

booleanfalse
triggerSize

Experimental. The trigger's height: `md` (default) a 40px pill with a 32px photo; `sm` a 32px row with a 24px photo.

"sm" | "md""md"
fullWidth

Experimental. 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"`.

booleanfalse
openboolean—
defaultOpenbooleanfalse
onOpenChange(open: boolean) => void—
accounts

Experimental. 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[]—
currentAccountId

Experimental. The `accounts` entry that is signed in now.

string—
onSwitch

Experimental. Called with another account's id when it is chosen; the menu closes first.

(accountId: string) => void—
onAddAccount

Experimental. Shows "Add another account" under the accounts.

() => void—
onManageAccounts

Experimental. Shows "Your accounts" under the accounts.

() => void—
accountLabels

Experimental. Words for the two account lines.

{ add?: string; manage?: string }—
side

Experimental. Where the panel opens: by default below, or above when there is no room; `top` always above (a sidebar's foot).

"auto" | "top""auto"
presentation

Experimental. `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"
portal

Renders the desktop panel in a portal on the body. Pass false to keep it inside the trigger's wrapper.

booleantrue
ref

The trigger button, for returning focus after the menu is swapped out.

Ref<HTMLButtonElement>—
classNamestring—

PresenceDot

PropTypeDefault
status*UserStatus | "offline"—
classNamestring—

Dependencies

npm
lucide-reactmotion
Registry
silicon-motion-tokens