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-menu
motionproduct
Loading…

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. Shared files are skipped if you already have them.

    • components/silicon-ui/user-menu/user-menu.tsx
    • components/silicon-ui/user-menu/user-menu.module.css
  3. Install the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

Source codetsx
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.

booleanfalse
openboolean—
defaultOpenbooleanfalse
onOpenChange(open: boolean) => void—
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