Skip to content

Components

Menu

A directional refractive glass menu whose container grows out of its trigger on any side — top, right, bottom or left — with labels, icons, shortcuts and keyboard navigation.

Markdown
Latest changeFixedv2.0.1GlassMenuLabel no longer crashes outside a GlassMenuGroup.
  1. v2.0.1FixedGlassMenuLabel no longer crashes outside a GlassMenuGroup.
  2. v2.0.0NewSubmenus (GlassMenuSub, GlassMenuSubTrigger, GlassMenuSubContent), checkbox and radio items, groups and shortcuts.
  3. v1.1.0NewMenu: a glass menu that opens toward any side, with labels, icons and shortcuts.
  4. All changes →
glass-menu-basic.tsx

Use it for

  • An action menu anchored to an icon button (...) or toolbar edge that needs to open above, below, left or right.
  • Structured menus with section labels, icons, keyboard shortcuts and disabled or destructive items.

Not for

  • Selecting a persistent form value: use Select.
  • Arbitrary rich layouts, inputs or date pickers: use Popover.

Installation

npm install @vitrumui/react
Peer: React 19

Keyboard arrow navigation, typeahead, focus management, positioning and ARIA come from UI SDK (@ui-sdk/core and @ui-sdk/react).

Usage

app.tsx
import { Ellipsis, Pencil, Copy, Trash2 } from 'lucide-react'
import {
  GlassMenu,
  GlassMenuContent,
  GlassMenuItem,
  GlassMenuLabel,
  GlassMenuSeparator,
  GlassMenuSub,
  GlassMenuSubContent,
  GlassMenuSubTrigger,
  GlassMenuTrigger,
} from '@vitrumui/react/menu'

<GlassMenu>
  <GlassMenuTrigger aria-label="More options" className="size-12 px-0">
    <Ellipsis />
  </GlassMenuTrigger>
  <GlassMenuContent side="bottom" align="center">
    <GlassMenuLabel>Document</GlassMenuLabel>
    <GlassMenuItem icon={<Pencil />} shortcut="⌘R">Rename</GlassMenuItem>
    <GlassMenuItem icon={<Copy />} shortcut="⌘D">Duplicate</GlassMenuItem>
    <GlassMenuSub>
      <GlassMenuSubTrigger>Share</GlassMenuSubTrigger>
      <GlassMenuSubContent>
        <GlassMenuItem>Copy link</GlassMenuItem>
        <GlassMenuItem>Invite team</GlassMenuItem>
      </GlassMenuSubContent>
    </GlassMenuSub>
    <GlassMenuSeparator />
    <GlassMenuItem destructive icon={<Trash2 />} shortcut="⌫">Delete</GlassMenuItem>
  </GlassMenuContent>
</GlassMenu>

Examples

All four sides
glass-menu-sides.tsx

Set side to "top", "right", "bottom" or "left": the glass morphs along the chosen axis so the trigger and menu stay one unified body.

Labels, icons, shortcuts & disabled items
glass-menu-options.tsx

Use GlassMenuLabel to group sections, icon and shortcut on GlassMenuItem for quick scanning, disabled to skip unavailable actions, and destructive for delete.

API reference

PropTypeDefault
open / defaultOpen / onOpenChange

On GlassMenu: control the menu yourself, or let it keep its own state.

boolean / boolean / (open: boolean) => void—
GlassMenuTrigger asChild

Put the trigger on its single child element instead of a glass button of its own.

booleanfalse
GlassMenuContent side

Which side of the trigger the menu grows towards.

'top' | 'right' | 'bottom' | 'left''bottom'
GlassMenuContent align / sideOffset

Alignment along the edge and gap in px between trigger and menu.

'start' | 'center' | 'end' / number'center' / 12
GlassMenuItem icon / shortcut

Optional leading icon and trailing keyboard shortcut hint (e.g. ⌘D).

ReactNode / ReactNode—
GlassMenuItem onSelect / disabled / destructive

Action callback, disabled state (skipped by keyboard) and destructive red styling.

() => void / boolean / boolean— / false / false
GlassMenuLabel / GlassMenuSeparator

Non-interactive section heading and hairline divider between groups.

div attributes / className—
GlassMenuSub / GlassMenuSubTrigger / GlassMenuSubContent

Nested submenu container, chevron-equipped submenu item trigger, and frosted submenu panel.

ComponentProps—

Accessibility

  • Implements the WAI-ARIA menu button pattern (aria-haspopup, role="menu", role="menuitem").
  • Up/Down arrows, Home, End and typeahead navigate items; disabled items are skipped; Enter/Space activates; Escape closes and restores focus.
  • Icon-only triggers (like ...) require an aria-label.
  • Respects reduced motion and falls back to a clean frosted menu without WebGL2.