Skip to content
Blobz docs

Avatar Account Menu

A ready-to-ship account menu with an avatar trigger, identity summary, and typed actions.

View code
avatar-account-menu-example.tsx
"use client";

import { AvatarAccountMenu } from "@/components/blobz/avatar-account-menu";

const ignoreAction = () => undefined;

const BLUE_PALETTE = ["#dff4ff", "#38bdf8"] as const;

const ACTIONS = [
	{
		id: "profile",
		label: "View profile",
		onSelect: ignoreAction,
	},
	{
		id: "settings",
		label: "Account settings",
		onSelect: ignoreAction,
	},
] as const;

export function AvatarAccountMenuExample() {
	return (
		<AvatarAccountMenu
			actions={ACTIONS}
			avatar={{
				name: "Janaki",
				palette: BLUE_PALETTE,
			}}
			email="janaki@example.com"
			name={"Janaki Ammal"}
			signOutAction={{
				id: "sign-out",
				label: "Sign out",
				onSelect: ignoreAction,
			}}
		/>
	);
}

Installation

npx shadcn@latest add @blobz/avatar-account-menu

The CLI also installs the official shadcn Dropdown Menu and the Blobz Avatar component.

Usage

"use client";

import { AvatarAccountMenu } from "@/components/blobz/avatar-account-menu";

<AvatarAccountMenu
  actions={[
    { id: "profile", label: "View profile", onSelect: openProfile },
    { id: "settings", label: "Settings", onSelect: openSettings },
  ]}
  avatar={{ name: user.id, src: user.image }}
  email={user.email}
  name={user.name}
  signOutAction={{ id: "sign-out", label: "Sign out", onSelect: signOut }}
/>

This block is a Client Component because its action callbacks cross the menu interaction boundary.

API

Prop

Type

The avatar source accepts a stable name and optional src, frame, palette, and choices. Images automatically fall back to the generated face.

Theme

On this page