Search documentation

Search pages, components, blocks, styles and colours.

Get started
Skip to content

User Menu

PreviousNext

The signed-in person's menu, as a sidebar row or an avatar.

User Menu shows who is signed in and opens their menu. The items are yours: pass Dropdown Menu groups as children.

  • variant="row" fills a sidebar row with the avatar, the name and the email. Put it in the sidebar footer, or in the header.
  • variant="mark" is the avatar alone, for a header or a sidebar header row.

User Menu is part of the Fabricator style.

Installation

bunx --bun fabricator-ui@latest add user-menu

Usage

import { UserMenu } from "@/components/ui/user-menu"
<SidebarFooter>
  <UserMenu
    user={{ name: user.name, email: user.email, avatarUrl: user.image }}
  >
    <DropdownMenuGroup>
      <DropdownMenuItem>Profile</DropdownMenuItem>
      <DropdownMenuItem>Settings</DropdownMenuItem>
    </DropdownMenuGroup>
    <DropdownMenuSeparator />
    <DropdownMenuGroup>
      <DropdownMenuItem onClick={signOut}>Sign out</DropdownMenuItem>
    </DropdownMenuGroup>
  </UserMenu>
</SidebarFooter>

Without an avatarUrl, the avatar shows the name's initials.

Placement

The menu opens to the right of a sidebar row, and below a mark or on phones. Set side and align to place it yourself.

API Reference

UserMenu

PropTypeDefault
user{ name, email?, avatarUrl? }-
variant"row" | "mark""row"
side"top" | "right" | "bottom" | "left"right, or bottom for a mark and on phones
align"start" | "center" | "end""end"
childrenDropdown Menu groups-

Accessibility

  • The trigger is a button; the mark is named "Account:" followed by the person's name.
  • The menu starts with a label holding the avatar, the name and the email, then your items. Keyboard and focus behaviour come from Dropdown Menu.