Skip to content
Haze UI

Account menu

Avatar-triggered popover with signed-in identity, account links, and a slot for actions such as signing out.

pnpm dlx shadcn@latest add @haze/account-menu
Open preview in a new tab
Livesmall script

When to use

  • A shell needs one place for personal settings and help links
  • A narrow toolbar needs a compact avatar trigger with an accessible name

When not to use

  • The menu controls an item unrelated to the current account. Use dropdown-menu.

Installation

Add the Haze registry to components.json once, then install Account menu with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/account-menu
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
id*string–Unique popover ID and CSS anchor name.
name*string–Display name for the account and source of initials.
identifierstring–Optional account detail, such as an email address or handle.
avatarSrcstring–Optional avatar image URL. Without an image, the trigger shows an account icon and the panel shows initials.
items*{ label: string; href: string; icon?: AstroComponent }[]–Links to account-related destinations.
compactbooleanfalseHide the name in the trigger while keeping it inside the popover.
labelstring"Account menu"Localized description announced after the account holder's name.
align"start" | "end""end"Edge of the trigger to align with the popover.
side"bottom" | "top""bottom"Preferred placement. Use top for a sidebar footer.
classstring–Additional classes on the wrapper.

Keyboard interactions

EnterSpace
Toggle the account popover.
Tab
Focus links and any supplied actions.
Arrow keysHomeEndLetters
Move among the account links or jump to one by name.
Escape
Close the popover.

Accessibility

  • The trigger has a textual accessible name even in compact mode.
  • Account links are native anchors and the popover preserves standard tab order.
  • The actions slot can hold your application's authenticated sign-out form.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Account menu" with `npx shadcn@latest add @haze/account-menu`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import AccountMenu from "@/components/haze/ui/account-menu.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/account-menu.md

  • Customize with real content

    Adapt the Haze account-menu ui for our product. Replace the demo values of these props with our real content: id, name, identifier, avatarSrc, items, compact, label, align, side, class. Keep the layout, the heading level rules and these accessibility details: The trigger has a textual accessible name even in compact mode. Account links are native anchors and the popover preserves standard tab order. The actions slot can hold your application's authenticated sign-out form. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using account-menu, check it fits: use it when a shell needs one place for personal settings and help links; a narrow toolbar needs a compact avatar trigger with an accessible name. Avoid it when the menu controls an item unrelated to the current account. use dropdown-menu.. Alternatives: @haze/dropdown-menu, @haze/popover, @haze/sidebar, @haze/avatar.

Dependencies

  • npm: @lucide/astro
  • @haze/avatar
  • @haze/dropdown-menu
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog