Account Menu
AccountMenu: the signed-in user in a Shell or topbar. The trigger shows an avatar (or initials) and the name, which hides on narrow screens; the menu has a header with the name, email and an optional role Badge, your app entries (Devices, Security, Invite) and sign-out, which can ask first through ConfirmDialog, whose confirm then needs a person's approval for agents.
Example
Open the account menu.
Installation
Usage
Put it in the Shell's actions (or a Topbar's trailing), with your app's entries in items and sign-out last; pass confirmSignOut when signing out costs the person something.
API reference
AccountMenu
| Prop | Type | Default |
|---|---|---|
userrequired | AccountUser | – |
roleLabelThe user's role, as a Badge in the menu's header. | ReactNode | – |
roleTone | Tone | "neutral" |
itemsApp entries above sign-out, like Devices, Security or Invite. | readonly AccountMenuItem[] | noItems |
signOutLabelrequired | ReactNode | – |
onSignOutrequiredSigns out; a returned Promise keeps the item, or the confirmation, pending until it settles. | () => unknown | – |
confirmSignOutAsks before signing out; the confirm button then needs a person's approval for an agent. | AccountMenuSignOutConfirm | – |
labels | Partial<AccountMenuLabels> | – |
className | string | – |
Other exports
accountMenuLabelstype AccountMenuItemtype AccountMenuLabelstype AccountMenuPropstype AccountMenuSignOutConfirmtype AccountUserAccessibility
- The trigger is named for the account (Account: Ana Ruiz by default, overridable), so its visible name stays part of it when the name hides on narrow screens.
- The header with the name, email and role names the group of entries; the avatar is decorative.
- Sign-out with a confirmation opens an alert dialog, with Cancel beside the confirm button.
Agent actions
Agents press the trigger with an entry's text, like Devices or Sign out. With confirmSignOut, the dialog's confirm button carries data-agent-confirm, so an agent's sign-out waits for a person.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.