Menu

Account Menu

A profile menu with a user header and a workspace switcher: the name, the address and the plan are visible before anyone reaches "sign out".

  • menu
  • dropdown
  • profile
  • account

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/dropdown-008?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 "dropdown-008" (Account 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/dropdown-008.json

Registry item: https://vibeui.ru/r/dropdown-008.json
Installs to: components/vibeui/dropdown-008.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 user header and a workspace switcher: the name, the address and the plan are visible before anyone reaches "sign out".

A profile menu: a header with name, email and plan, a radio group of workspaces and a separated sign-out. One file, zero dependencies.

## 3. How to use it
import { Dropdown008 } from "@/components/vibeui/dropdown-008"

<Dropdown008
  name="Vera Loginova"
  email="vera@poldenstudio.com"
  plan="Pro"
  workspaces={["Personal", "Polden Studio"]}
/>

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-dropdown-008-* palette: the component must look the same in any project
- the header as information, not as a menu item: it must not appear in the arrow-key walk
- the menuitemradio role on workspaces — that is a single choice, not a command
- sign-out last and behind a separator: it is the only irreversible entry in the list
- the ellipsis on a long address: a 40-character email would stretch the menu
- the component's own light surface: on the dark catalog card dark text disappears

## 6. You may change
- the name through name, the address through email and the plan through plan
- the workspace list through workspaces
- the avatar, badge and focus colour through accent
- the entries below the separator directly in the markup

## 7. Rules
- Initials come from the first two words of the name: a single word yields one letter, which is fine.
- The avatar is drawn with letters; for a photo replace the face node with an img and an alt.
- Past six workspaces give the list a scroll and a search box, or the menu outgrows the screen.
- 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/dropdown-008.json
https://vibeui.ru/r/dropdown-008.json

Один файл, ноль зависимостей, палитра --vibeui-dropdown-008-*. Клиентский: выбранное пространство держит useState. Шапка меню — не пункт, а справка: она не фокусируется и не нажимается, поэтому не мешает ходить стрелками. Инициалы считаются из имени функцией, аватар — цветной круг на color-mix от акцента. Пространства размечены role=menuitemradio с aria-checked внутри role=group: их выбирают, а не выполняют. Выход отделён линией и покрашен только текстом. Открытие и слой — HTML popover, положение — anchor-name и position-area под @supports.

Component source

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

"use client"

import { useId, useRef, useState } from "react"
import type {
  ComponentPropsWithoutRef,
  CSSProperties,
  KeyboardEvent,
} from "react"

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

// Идея компонента: меню профиля, у которого шапка отвечает на вопрос «под кем
// я вошёл», а середина — «в каком пространстве я работаю». Оба ответа нужны до
// нажатия «выйти», а в узкой кнопке шапки для них нет места. Пространства —
// радиогруппа с отметкой: их выбирают, а не выполняют. Выход отделён чертой и
// стоит последним: это единственное необратимое действие списка.
const STYLES = `
:where([data-vibeui-block="dropdown-008"]){
--vibeui-dropdown-008-bg:oklch(1 0 0);
--vibeui-dropdown-008-fg:oklch(0.24 0.014 265);
--vibeui-dropdown-008-muted:oklch(0.56 0.014 265);
--vibeui-dropdown-008-border:oklch(0.9 0.006 265);
--vibeui-dropdown-008-hover:oklch(0.96 0.004 265);
--vibeui-dropdown-008-accent:oklch(0.55 0.18 258);
--vibeui-dropdown-008-danger:oklch(0.56 0.19 25);
--vibeui-dropdown-008-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="dropdown-008"]{
display:inline-flex;box-sizing:border-box;padding:0.375rem;
background:var(--vibeui-dropdown-008-bg);
border:1px solid var(--vibeui-dropdown-008-border);border-radius:9999px;
font-family:var(--vibeui-dropdown-008-font);color:var(--vibeui-dropdown-008-fg);
}
[data-vibeui-block="dropdown-008"] [data-part="trigger"]{
appearance:none;cursor:pointer;
display:inline-flex;align-items:center;gap:0.5rem;
height:2.25rem;padding:0 0.75rem 0 0.25rem;
border:0;border-radius:9999px;background:none;color:inherit;
font:inherit;font-size:0.8125rem;font-weight:600;
anchor-name:--vibeui-dropdown-008-anchor;
transition:background-color .16s ease;
}
[data-vibeui-block="dropdown-008"] [data-part="trigger"]:hover{background:var(--vibeui-dropdown-008-hover)}
[data-vibeui-block="dropdown-008"] [data-part="trigger"]:focus-visible{outline:2px solid var(--vibeui-dropdown-008-accent);outline-offset:2px}
[data-vibeui-block="dropdown-008"] [data-part="face"]{
display:flex;align-items:center;justify-content:center;flex:none;
width:1.75rem;height:1.75rem;border-radius:9999px;
background:color-mix(in oklab,var(--vibeui-dropdown-008-accent) 18%,oklch(1 0 0));
color:var(--vibeui-dropdown-008-accent);
font-size:0.6875rem;font-weight:700;letter-spacing:0.02em;
}
[data-vibeui-block="dropdown-008"] [data-part="menu"]{
position:fixed;padding:0.3125rem;width:16rem;box-sizing:border-box;
background:var(--vibeui-dropdown-008-bg);color:var(--vibeui-dropdown-008-fg);
border:1px solid var(--vibeui-dropdown-008-border);border-radius:0.875rem;
box-shadow:0 20px 44px -24px oklch(0.2 0.03 265 / 50%);
font-family:var(--vibeui-dropdown-008-font);
opacity:0;transform:translateY(-0.25rem);
transition:opacity .14s ease,transform .14s ease,display .14s allow-discrete,overlay .14s allow-discrete;
}
[data-vibeui-block="dropdown-008"] [data-part="menu"]:popover-open{opacity:1;transform:none}
@starting-style{[data-vibeui-block="dropdown-008"] [data-part="menu"]:popover-open{opacity:0;transform:translateY(-0.25rem)}}
@supports (anchor-name: --a){
[data-vibeui-block="dropdown-008"] [data-part="menu"]{
position-anchor:--vibeui-dropdown-008-anchor;
position-area:bottom span-left;margin:0.375rem 0 0;
position-try-fallbacks:flip-block,flip-inline;
}
}
/* Шапка не кликается: это справка, а не пункт меню. */
[data-vibeui-block="dropdown-008"] [data-part="head"]{
display:flex;align-items:center;gap:0.625rem;
padding:0.5rem;margin-bottom:0.25rem;
border-radius:0.625rem;
background:color-mix(in oklab,var(--vibeui-dropdown-008-accent) 6%,transparent);
}
[data-vibeui-block="dropdown-008"] [data-part="head"] [data-part="face"]{width:2.25rem;height:2.25rem;font-size:0.8125rem}
[data-vibeui-block="dropdown-008"] [data-part="who"]{display:flex;flex-direction:column;min-width:0;gap:0.0625rem}
[data-vibeui-block="dropdown-008"] [data-part="name"]{font-size:0.8125rem;font-weight:650;line-height:1.2}
[data-vibeui-block="dropdown-008"] [data-part="mail"]{
font-size:0.6875rem;color:var(--vibeui-dropdown-008-muted);line-height:1.3;
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
[data-vibeui-block="dropdown-008"] [data-part="plan"]{
margin-left:auto;flex:none;padding:0.125rem 0.4375rem;border-radius:9999px;
background:var(--vibeui-dropdown-008-accent);color:oklch(0.99 0 0);
font-size:0.625rem;font-weight:700;letter-spacing:0.03em;text-transform:uppercase;
}
[data-vibeui-block="dropdown-008"] [data-part="title"]{
padding:0.4375rem 0.5rem 0.25rem;
font-size:0.6875rem;font-weight:650;letter-spacing:0.06em;text-transform:uppercase;
color:var(--vibeui-dropdown-008-muted);
}
[data-vibeui-block="dropdown-008"] [data-part="item"]{
display:flex;align-items:center;gap:0.5rem;
width:100%;box-sizing:border-box;
appearance:none;border:0;background:none;cursor:pointer;
padding:0.4375rem 0.5rem;border-radius:0.5rem;
font:inherit;font-size:0.8125rem;color:inherit;text-align:left;
transition:background-color .14s ease;
}
[data-vibeui-block="dropdown-008"] [data-part="item"]:hover{background:var(--vibeui-dropdown-008-hover)}
[data-vibeui-block="dropdown-008"] [data-part="item"]:focus-visible{outline:2px solid var(--vibeui-dropdown-008-accent);outline-offset:-2px}
[data-vibeui-block="dropdown-008"] [data-part="item"][data-danger="true"]{color:var(--vibeui-dropdown-008-danger)}
[data-vibeui-block="dropdown-008"] [data-part="chip"]{
display:flex;align-items:center;justify-content:center;flex:none;
width:1.25rem;height:1.25rem;border-radius:0.375rem;
background:var(--vibeui-dropdown-008-hover);
font-size:0.625rem;font-weight:700;color:var(--vibeui-dropdown-008-muted);
}
[data-vibeui-block="dropdown-008"] [data-part="tick"]{
margin-left:auto;width:0.9375rem;height:0.9375rem;flex:none;
color:var(--vibeui-dropdown-008-accent);opacity:0;
}
[data-vibeui-block="dropdown-008"] [data-part="item"][aria-checked="true"] [data-part="tick"]{opacity:1}
[data-vibeui-block="dropdown-008"] [data-part="rule"]{
height:1px;margin:0.3125rem 0.25rem;background:var(--vibeui-dropdown-008-border);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="dropdown-008"] *{animation:none!important;transition:none!important}}
`

const DEFAULT_WORKSPACES = ["Личное", "Студия «Полдень»", "Клиент: Аврора"]

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

function stepFocus(menu: HTMLElement | null, delta: number) {
  if (!menu) {
    return
  }

  const items = Array.from(
    menu.querySelectorAll<HTMLElement>('[data-part="item"]'),
  )

  if (items.length === 0) {
    return
  }

  const from = items.indexOf(document.activeElement as HTMLElement)
  items[(from + delta + items.length) % items.length].focus()
}

/**
 * Меню профиля с шапкой пользователя и переключением рабочих пространств.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Dropdown008({
  name = "Вера Логинова",
  email = "vera@poldenstudio.ru",
  plan = "Pro",
  workspaces = DEFAULT_WORKSPACES,
  accent,
  className,
  style,
  ...props
}: Dropdown008Props) {
  const id = useId()
  const menu = useRef<HTMLDivElement>(null)
  const [space, setSpace] = useState(workspaces[0])

  const palette = {
    ...(accent ? { "--vibeui-dropdown-008-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-dropdown-008" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="dropdown-008"
        className={className}
        style={palette}
      >
        <button
          type="button"
          data-part="trigger"
          popoverTarget={`${id}-menu`}
          aria-haspopup="menu"
          onKeyDown={(event) => {
            if (event.key === "ArrowDown") {
              event.preventDefault()
              const node = menu.current

              if (node) {
                if (!node.matches(":popover-open")) {
                  node.showPopover()
                }

                requestAnimationFrame(() =>
                  node
                    .querySelector<HTMLElement>('[data-part="item"]')
                    ?.focus(),
                )
              }
            }
          }}
        >
          <span data-part="face" aria-hidden="true">
            {initials(name)}
          </span>
          {name.split(" ")[0]}
        </button>
        <div
          id={`${id}-menu`}
          ref={menu}
          popover="auto"
          role="menu"
          aria-label={`Профиль: ${name}`}
          data-part="menu"
          onKeyDown={(event: KeyboardEvent<HTMLDivElement>) => {
            if (event.key === "ArrowDown") {
              event.preventDefault()
              stepFocus(menu.current, 1)
            } else if (event.key === "ArrowUp") {
              event.preventDefault()
              stepFocus(menu.current, -1)
            }
          }}
        >
          <div data-part="head">
            <span data-part="face" aria-hidden="true">
              {initials(name)}
            </span>
            <span data-part="who">
              <span data-part="name">{name}</span>
              <span data-part="mail">{email}</span>
            </span>
            <span data-part="plan">{plan}</span>
          </div>
          <div data-part="title" id={`${id}-spaces`}>
            Пространства
          </div>
          <div role="group" aria-labelledby={`${id}-spaces`}>
            {workspaces.map((workspace) => (
              <button
                key={workspace}
                type="button"
                role="menuitemradio"
                aria-checked={space === workspace}
                data-part="item"
                onClick={() => {
                  setSpace(workspace)
                  menu.current?.hidePopover()
                }}
              >
                <span data-part="chip" aria-hidden="true">
                  {workspace[0]}
                </span>
                {workspace}
                <svg
                  data-part="tick"
                  viewBox="0 0 24 24"
                  fill="none"
                  aria-hidden="true"
                >
                  <path
                    d="M5 12.5l4.5 4.5L19 7"
                    stroke="currentColor"
                    strokeWidth="2.6"
                    strokeLinecap="round"
                    strokeLinejoin="round"
                  />
                </svg>
              </button>
            ))}
          </div>
          <div data-part="rule" role="separator" />
          <button
            type="button"
            role="menuitem"
            data-part="item"
            onClick={() => menu.current?.hidePopover()}
          >
            Настройки аккаунта
          </button>
          <button
            type="button"
            role="menuitem"
            data-part="item"
            onClick={() => menu.current?.hidePopover()}
          >
            Счета и оплата
          </button>
          <div data-part="rule" role="separator" />
          <button
            type="button"
            role="menuitem"
            data-part="item"
            data-danger="true"
            onClick={() => menu.current?.hidePopover()}
          >
            Выйти
          </button>
        </div>
      </div>
    </>
  )
}