Skip to content
Haze UI

Profile dropdown

Spacious account card trigger with status-dot initials avatar opening a width-matched popover with workspace badge and icon links.

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

When to use

  • An application header or sidebar needs an account card showing avatar, name, email and plan badge
  • Account navigation should open anchored to the trigger card with clean keyboard and no-JS fallback

When not to use

  • A generic action menu without user identity details is needed; use dropdown-menu
  • A minimal name-and-links trigger without plan tier or grouped sections is sufficient; use account-menu

Installation

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

pnpm dlx shadcn@latest add @haze/profile-dropdown
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 ID linking the trigger popovertarget, CSS anchor name and menu panel.
namestring"Maya Lin"User display name shown in the trigger card and used to derive initials.
emailstring"maya@bramble.studio"Email address rendered beneath the name on the trigger card and inside the menu header.
workspacestring"Bramble Studio"Workspace or organization name shown beside the plan badge at the top of the popover.
avatarSrcstring–Optional avatar photo URL; high-contrast initials render when omitted.
status"online" | "away""online"Presence indicator dot offset cleanly at the bottom-right rim of the avatar.
planstring"Pro"Subscription or tier label shown as a badge inside the popover header.
groups{ heading?: string; items: { label: string; href: string; hint?: string; icon?: string }[] }[]4 account linksGrouped icon-prefixed account links with optional section headings and keyboard hints.
signOutLabelstring"Sign out"Text label for the destructive sign-out link in the menu footer.
signOutHrefstring"#sign-out"Destination URL for the sign-out link.
align"start" | "end""end"Horizontal edge of the trigger card to align the popover against.
side"bottom" | "top""bottom"Preferred vertical side relative to the trigger before anchor flipping.
compactbooleanfalseShow only the avatar and chevrons icon on the trigger button.
classstring–Additional classes on the outer wrapper.

Keyboard interactions

EnterSpace
Open or close the profile popover from the account trigger card
ArrowDownArrowUp
Open the menu or move focus across icon links and Sign out
HomeEnd
Jump focus to the first or last account menu item
Escape
Close the popover and return focus to the account trigger

Accessibility

  • Uses native popover and popovertarget so opening, light-dismiss and Escape work without scripts.
  • Enhances keyboard navigation with ArrowDown, ArrowUp, Home, End and character typeahead across all menu items and Sign out.
  • Syncs aria-expanded on the trigger button and respects prefers-reduced-motion for panel transitions.

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 "Profile dropdown" with `npx shadcn@latest add @haze/profile-dropdown`. 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 ProfileDropdown from "@/components/haze/ui/profile-dropdown.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/profile-dropdown.md

  • Customize with real content

    Adapt the Haze profile-dropdown ui for our product. Replace the demo values of these props with our real content: id, name, email, workspace, avatarSrc, status, plan, groups, signOutLabel, signOutHref, align, side, compact, class. Keep the layout, the heading level rules and these accessibility details: Uses native popover and popovertarget so opening, light-dismiss and Escape work without scripts. Enhances keyboard navigation with ArrowDown, ArrowUp, Home, End and character typeahead across all menu items and Sign out. Syncs aria-expanded on the trigger button and respects prefers-reduced-motion for panel transitions. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using profile-dropdown, check it fits: use it when an application header or sidebar needs an account card showing avatar, name, email and plan badge; account navigation should open anchored to the trigger card with clean keyboard and no-js fallback. Avoid it when a generic action menu without user identity details is needed; use dropdown-menu; a minimal name-and-links trigger without plan tier or grouped sections is sufficient; use account-menu. Alternatives: @haze/account-menu, @haze/dropdown-menu.

Dependencies

  • npm: @lucide/astro
  • @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