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
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
| Key | Does |
|---|---|
| Enter or Space | Opens the menu from the avatar |
| Up or Down arrow | Previous or next item |
| Esc | Closes 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.