Skip to content
Alea
Pro
  1. Alea
  2. Components
  3. Navigation
  4. AccountMenu

Navigation

AccountMenu

The avatar button at the end of an app header. It opens a menu that starts with who is signed in, then your items: profile, settings, sign out.

import { AccountMenu, MenuItem, MenuSeparator } from '@alea-design/ui';

Examples

Account menu

The avatar is the button. The menu starts with who is signed in, then your items. onAction gets the id of the item.

Tokens

The design tokens this component reads, with their value in the current theme. Override any of them to restyle it.

Color

  • --alea-text…
  • --alea-text-muted…

Space

  • --alea-space-0-5…
  • --alea-space-3…

Type

  • --alea-font-family-body…
  • --alea-font-size-md…
  • --alea-font-size-sm…
  • --alea-font-weight-semibold…

Props

AccountMenu props

The avatar button at the end of a header that opens the account menu: who is signed in on top, then profile, settings and sign out.

PropTypeDefaultDescription
childrenrequiredReactNode | ((item: object) => ReactNode)The MenuItems, MenuSections and MenuSeparators: profile, settings, sign out.
namerequiredstringThe person's name: the avatar's initials and the first line of the menu header.
aria-labelstring"{name}, account menu"Name of the menu button. Default "{name}, account menu".
classNamestringnoneExtra class names for the popup.
footerReactNodenoneContent under the items, not focusable: a version, a hint.
maxHeightnumbernoneMost height before it scrolls, in px.
menuPropsOmit<MenuProps<object>, "children">noneMenu props: onAction, selectionMode, selectedKeys, items, disabledKeys...
minWidthstring | number200Least width of the menu, any CSS length. Default 200 px.
motionMotionPropnoneHow the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options.
onAction((key: string | number) => void)noneCalled with the menu item's id.
placement"start" | "end" | "bottom end" | "bottom start" | "bottom" | "top" | "bottom left" | "bottom right" | "top left" | "top right" | "top start" | "top end" | "l…"bottom end"Where it opens. Default bottom start.
secondaryReactNodenoneA second line in the menu header: an email or a role.
size"sm" | "md" | "lg""md"Size of the button: sm 32, md 40 (default, as the other header buttons), lg 48.
srcstringnoneThe photo. Initials show without it.
styleCSSPropertiesnoneInline style for the popup.

Specs

Generated from the source: the variants in the types, the states and tokens in the CSS, and the motion patterns that apply. The grids render the real component in both themes; the numbers are measured from the page.

Variants
placementstartendbottom endbottom startbottomtopbottom leftbottom righttop lefttop righttop starttop endl…
sizesmmdlg
Motion
Takes a motion prop for its entrance and exit.
Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-account-menu.alea-account-head.alea-account-text.alea-account-name.alea-account-secondary

Accessibility

  • The avatar is a real button named "{name}, account menu"; set aria-label to change it.
  • The menu is a menu button: arrows move, Escape closes and focus goes back to the avatar.
  • Who is signed in is shown in the menu header as text, not in the button, so it is read when the menu opens.

Keyboard

KeyDoes
Enter or SpaceOpens the menu from the avatar
Up or Down arrowPrevious or next item
EscCloses the menu and returns to the avatar

Do and don't

Do

  • Keep it to five items or fewer: profile, settings, help, sign out.
  • Put sign out last, after a separator.
  • Use the same size as the other header buttons (the default, 40 px).

Don't

  • Don't use it as a workspace switcher: use WorkspaceSwitcher in the sidebar.
  • Don't put the person's name in the button next to the avatar: the header gets crowded.
Tested with axe, keyboard and screen reader roles