Skip to content
Eskais UI

Accounts

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

Northwind

Open the account menu.

Installation

npx shadcn@latest add @eskais/account-menu

Usage

Import
import { AccountMenu, accountMenuLabels } from "@/components/ui/account-menu"

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

PropTypeDefault
userrequiredAccountUser–
roleLabelThe user's role, as a Badge in the menu's header.ReactNode–
roleToneTone"neutral"
itemsApp entries above sign-out, like Devices, Security or Invite.readonly AccountMenuItem[]noItems
signOutLabelrequiredReactNode–
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–
labelsPartial<AccountMenuLabels>–
classNamestring–

Other exports

accountMenuLabelstype AccountMenuItemtype AccountMenuLabelstype AccountMenuPropstype AccountMenuSignOutConfirmtype AccountUser

Accessibility

  • 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.