# User Menu (Andromeda Legacy)

User Menu is a component of the free, MIT-licensed Andromeda Legacy design system from AI Canvas (https://aicanvas.me). Index of every system, component and install setup: https://aicanvas.me/llms.txt

Avatar-trigger popover whose menu rows are supplied by the caller via an `items` prop. Designed for top-bar slots where space is tight. Opens downward and right-aligned by default; closes on outside-click and Escape.

- Design system: [Andromeda Legacy](https://aicanvas.me/design-systems/andromeda.md)
- License: MIT
- Install slug: `andromeda-user-menu`
- Page: https://aicanvas.me/design-systems/andromeda/user-menu

## Install

```bash
npx shadcn@latest add @aicanvas/andromeda-user-menu
```

Needs a free AI Canvas account; signed out, the command writes a placeholder (an `AccountRequired` notice) instead.

Every Andromeda Legacy component at once: `npx shadcn@latest add @aicanvas/andromeda`.

Token setup: the Install section of https://aicanvas.me/llms.txt.

## Use it

It installs to `components/aicanvas/andromeda/components/UserMenu.tsx` (under `src/` if your project has one). With the usual `@/` alias:

```tsx
import { UserMenu } from '@/components/aicanvas/andromeda/components/UserMenu'
```

## Example

```tsx
import { UserMenu } from '@/components/aicanvas/andromeda/components/UserMenu'

<UserMenu
  name="Mira Chen"
  status="online"
  items={[{ id: 'profile', label: 'Profile' }, { id: 'signout', label: 'Sign out' }]}
/>
```

## Parts

User Menu is built from `UserMenuItem` and `UserMenu`. Each part has its own props table below.

## Variants

- `status` on `UserMenu`: online, caution, fault or offline
- `avatarSize` on `UserMenu`: sm, md or lg (default 'md')
- `placement` on `UserMenu`: top or bottom (default 'bottom')
- `align` on `UserMenu`: start or end (default 'end')

## Props

### UserMenuItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `id?` | `string` |  | Stable key for the row, falling back to its array index. |
| `label?` | `string` |  | Text shown on the menu item, rendered uppercase. |
| `icon?` | `React.ComponentType<IconProps>` |  | Icon component rendered before the label. |
| `onSelect?` | `() => void` |  | Handler called when the item is chosen; the menu closes after. |
| `destructive?` | `boolean` |  | Renders the item in the destructive red color. |
| `type?` | `'separator'` |  | Set to 'separator' to render a divider instead of an item. |

### UserMenu

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `name` | `string` |  | Display name; passed to Avatar for the initial fallback. |
| `src?` | `string` |  | Avatar image URL. |
| `status?` | `'online'\|'caution'\|'fault'\|'offline'` |  | Presence state; passed to Avatar for the status dot. |
| `avatarSize?` | `'sm'\|'md'\|'lg'` | `'md'` | Size of the trigger avatar. |
| `items` | `UserMenuItem[]` |  | The menu rows to render, including separators. |
| `placement?` | `'top'\|'bottom'` | `'bottom'` | Whether the panel opens below or above the trigger. |
| `align?` | `'start'\|'end'` | `'end'` | Which trigger edge the panel aligns to horizontally. |
| `defaultOpen?` | `boolean` | `false` | Render the menu pre-opened (showcases / docs). Outside-click and Escape still dismiss it. |
| `staticOpen?` | `boolean` | `false` | Render pre-opened AND pinned; outside-click / Escape do not dismiss it. For showcases / docs where several popovers are shown open at once and one must not close the others. |
| `ariaLabel?` | `string` | `'User menu'` | Accessible label for the trigger button and menu panel. |
| `className?` | `string` |  | Class name applied to the wrapper element. |
| `style?` | `React.CSSProperties` |  | Inline styles merged onto the wrapper element. |

## More Andromeda Legacy components

- [Alert](https://aicanvas.me/design-systems/andromeda/alert.md)
- [Avatar](https://aicanvas.me/design-systems/andromeda/avatar.md)
- [Badge](https://aicanvas.me/design-systems/andromeda/badge.md)
- [Button](https://aicanvas.me/design-systems/andromeda/button.md)
- [Card](https://aicanvas.me/design-systems/andromeda/card.md)
