Skip to content

Components

MenuNew

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 changeNewv1.0.0Added GlassMenu (@vitrumui/react/menu): four-sided directional morphing (top, right, bottom, left) with labels, icons and shortcuts.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
No dependencies

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,
  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>
    <GlassMenuSeparator />
    <GlassMenuItem destructive icon={<Trash2 />} shortcut="⌫">Delete</GlassMenuItem>
  </GlassMenuContent>
</GlassMenu>

Examples

Coming soon

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—

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.