Menu

Profile Menu

A profile menu with a header: name and email inside the menu, sign-out separated by a rule as the one irreversible action.

  • menu
  • profile
  • account
  • popover

Preview

1440pxHost theme

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.

put this in the header: https://vibeui.ru/c/menu-004?lang=en

Show the full instructions

What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.

# Install and place "menu-004" (Profile Menu) from VibeUI

## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/menu-004.json

Registry item: https://vibeui.ru/r/menu-004.json
Installs to: components/vibeui/menu-004.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.

Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.

## 2. What it is
A profile menu with a header: name and email inside the menu, sign-out separated by a rule as the one irreversible action.

A profile menu: an initials button, a header with name, email and plan, settings items and a separated sign-out. Zero dependencies, one file, no client JS.

## 3. How to use it
import { Menu004 } from "@/components/vibeui/menu-004"

<Menu004 name="Anna Petrova" email="anna@example.com" plan="Team" />

Read the installed file for the full prop list.

## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.

Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)

## 5. Keep exactly as installed
- the local --vibeui-menu-004-* palette — do not swap it for your theme tokens
- the header with name and email inside the menu: you must know who you are before signing out
- sign-out in its own group and coloured by text
- aligning the layer to the button's right edge — a profile menu lives in the top-right corner
- the @supports fallback for browsers without anchor positioning
- the aria-label on the button carrying the name: initials say nothing aloud

## 6. You may change
- name, email and plan
- the menu items
- the accent through the accent prop
- the button shape

## 7. Rules
- The email is personal data: shorten it on shared screens.
- The items do nothing: handlers belong to the caller.
- Sign-out deserves a confirmation when unsaved drafts exist.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.

## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.

For developers

npx shadcn@latest add https://vibeui.ru/r/menu-004.json
https://vibeui.ru/r/menu-004.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-menu-004-*. Серверный компонент: открытие держит popover, позиция — anchor positioning с правым выравниванием и запасным правилом в @supports. Оттенок аватара считается из имени FNV-1a по двенадцати ступеням круга.

Component source

The same file your agent installs. Here in case you would rather copy it by hand.

import { useId } from "react"
import type { ComponentPropsWithoutRef, CSSProperties } from "react"

export type Menu004Props = Omit<ComponentPropsWithoutRef<"div">, "children"> & {
  name?: string
  email?: string
  plan?: string
  accent?: string
}

// Идея компонента: меню профиля с шапкой. Имя и почта стоят внутри меню, а не
// в кнопке: на узкой шапке для них нет места, а знать, под кем ты вошёл, надо
// до нажатия «выйти». Выход отделён чертой и покрашен текстом — это последнее
// действие в списке и единственное необратимое.
const STYLES = `
:where([data-vibeui-block="menu-004"]){
--vibeui-menu-004-bg:oklch(1 0 0);
--vibeui-menu-004-fg:oklch(0.24 0.014 265);
--vibeui-menu-004-muted:oklch(0.56 0.014 265);
--vibeui-menu-004-border:oklch(0.9 0.006 265);
--vibeui-menu-004-hover:oklch(0.96 0.004 265);
--vibeui-menu-004-danger:oklch(0.56 0.19 25);
--vibeui-menu-004-accent:oklch(0.55 0.17 265);
--vibeui-menu-004-hue:250;
--vibeui-menu-004-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="menu-004"]{
display:inline-block;font-family:var(--vibeui-menu-004-font);color:var(--vibeui-menu-004-fg);
}
[data-vibeui-block="menu-004"] [data-part="trigger"]{
appearance:none;cursor:pointer;
display:inline-flex;align-items:center;gap:0.5rem;
height:2.5rem;padding:0 0.625rem 0 0.375rem;
border:1px solid var(--vibeui-menu-004-border);border-radius:9999px;
background:var(--vibeui-menu-004-bg);color:inherit;
font:inherit;font-size:0.8125rem;font-weight:600;
anchor-name:--vibeui-menu-004-anchor;
}
[data-vibeui-block="menu-004"] [data-part="trigger"]:hover{background:var(--vibeui-menu-004-hover)}
[data-vibeui-block="menu-004"] [data-part="trigger"]:focus-visible{outline:2px solid var(--vibeui-menu-004-accent);outline-offset:2px}
[data-vibeui-block="menu-004"] [data-part="face"]{
display:flex;align-items:center;justify-content:center;flex:none;
width:1.75rem;height:1.75rem;border-radius:9999px;
background:oklch(0.92 0.05 var(--vibeui-menu-004-hue));
color:oklch(0.38 0.09 var(--vibeui-menu-004-hue));
font-size:0.6875rem;font-weight:700;
}
[data-vibeui-block="menu-004"] [popover]{
position:fixed;margin:0;padding:0.3125rem;min-width:14rem;
border:1px solid var(--vibeui-menu-004-border);border-radius:0.875rem;
background:var(--vibeui-menu-004-bg);color:inherit;
box-shadow:0 18px 40px -22px oklch(0.2 0.02 265 / 55%);
position-anchor:--vibeui-menu-004-anchor;
top:anchor(bottom);right:anchor(right);margin-top:0.375rem;
}
@supports not (anchor-name: --a){
[data-vibeui-block="menu-004"]{position:relative}
[data-vibeui-block="menu-004"] [popover]{position:absolute;top:calc(100% + 0.375rem);right:0;inset:auto}
}
/* Шапка внутри меню: под кем вошёл, надо знать до нажатия «выйти». */
[data-vibeui-block="menu-004"] [data-part="head"]{
display:flex;flex-direction:column;gap:0.125rem;
padding:0.5rem 0.5rem 0.625rem;margin-bottom:0.3125rem;
border-bottom:1px solid var(--vibeui-menu-004-border);
}
[data-vibeui-block="menu-004"] [data-part="name"]{font-size:0.875rem;font-weight:650}
[data-vibeui-block="menu-004"] [data-part="email"]{font-size:0.75rem;color:var(--vibeui-menu-004-muted)}
[data-vibeui-block="menu-004"] [data-part="plan"]{
align-self:flex-start;margin-top:0.25rem;
padding:0.0625rem 0.375rem;border-radius:9999px;
background:color-mix(in oklab,var(--vibeui-menu-004-accent) 12%,oklch(1 0 0));
color:color-mix(in oklab,var(--vibeui-menu-004-accent) 75%,oklch(0.2 0.02 265));
font-size:0.6875rem;font-weight:650;
}
[data-vibeui-block="menu-004"] [data-part="item"]{
display:block;width:100%;min-height:2rem;padding:0 0.5rem;
appearance:none;border:0;border-radius:0.5rem;background:transparent;color:inherit;
font:inherit;font-size:0.8125rem;text-align:left;cursor:pointer;
}
[data-vibeui-block="menu-004"] [data-part="item"]:hover{background:var(--vibeui-menu-004-hover)}
[data-vibeui-block="menu-004"] [data-part="item"]:focus-visible{outline:2px solid var(--vibeui-menu-004-accent);outline-offset:-2px}
/* Выход отделён чертой: последнее действие и единственное необратимое. */
[data-vibeui-block="menu-004"] [data-part="exit"]{
margin-top:0.3125rem;padding-top:0.3125rem;border-top:1px solid var(--vibeui-menu-004-border);
}
[data-vibeui-block="menu-004"] [data-part="exit"] [data-part="item"]{color:var(--vibeui-menu-004-danger)}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="menu-004"] *{animation:none!important;transition:none!important}}
`

function hue(name: string) {
  let hash = 2166136261

  for (const symbol of name) {
    hash ^= symbol.codePointAt(0)!
    hash = Math.imul(hash, 16777619)
  }

  return ((hash >>> 0) % 12) * 30
}

function initials(name: string) {
  return name
    .split(" ")
    .slice(0, 2)
    .map((part) => part[0]?.toUpperCase() ?? "")
    .join("")
}

/**
 * Меню профиля: шапка с именем и почтой, выход отделён чертой.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Menu004({
  name = "Анна Петрова",
  email = "anna@example.com",
  plan = "Команда",
  accent,
  className,
  style,
  ...props
}: Menu004Props) {
  const id = useId().replace(/:/g, "")
  const palette = {
    "--vibeui-menu-004-hue": hue(name),
    ...(accent ? { "--vibeui-menu-004-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-menu-004" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="menu-004"
        className={className}
        style={palette}
      >
        <button
          type="button"
          data-part="trigger"
          popoverTarget={`${id}-menu`}
          aria-label={`Меню профиля: ${name}`}
        >
          <span data-part="face" aria-hidden="true">
            {initials(name)}
          </span>
          {name}
        </button>
        <div id={`${id}-menu`} popover="auto" role="menu" aria-label="Профиль">
          <div data-part="head">
            <span data-part="name">{name}</span>
            <span data-part="email">{email}</span>
            {plan ? <span data-part="plan">{plan}</span> : null}
          </div>
          <button type="button" role="menuitem" data-part="item">
            Профиль и настройки
          </button>
          <button type="button" role="menuitem" data-part="item">
            Оплата и счета
          </button>
          <button type="button" role="menuitem" data-part="item">
            Пригласить в команду
          </button>
          <div data-part="exit">
            <button type="button" role="menuitem" data-part="item">
              Выйти
            </button>
          </div>
        </div>
      </div>
    </>
  )
}