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.
Latest changeFixedv2.0.1GlassMenuLabel no longer crashes outside a GlassMenuGroup.
- v2.0.1Fixed
GlassMenuLabelno longer crashes outside aGlassMenuGroup. - v2.0.0NewSubmenus (
GlassMenuSub,GlassMenuSubTrigger,GlassMenuSubContent), checkbox and radio items, groups and shortcuts. - v1.1.0NewMenu: a glass menu that opens toward any side, with labels, icons and shortcuts.
- All changes →
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/reactKeyboard arrow navigation, typeahead, focus management, positioning and ARIA come from UI SDK (@ui-sdk/core and @ui-sdk/react).
Usage
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
Set side to "top", "right", "bottom" or "left": the glass morphs along the chosen axis so the trigger and menu stay one unified body.
Use GlassMenuLabel to group sections, icon and shortcut on GlassMenuItem for quick scanning, disabled to skip unavailable actions, and destructive for delete.
API reference
| Prop | Type | Default |
|---|---|---|
open / defaultOpen / onOpenChangeOn | boolean / boolean / (open: boolean) => void | — |
GlassMenuTrigger asChildPut the trigger on its single child element instead of a glass button of its own. | boolean | false |
GlassMenuContent sideWhich side of the trigger the menu grows towards. | 'top' | 'right' | 'bottom' | 'left' | 'bottom' |
GlassMenuContent align / sideOffsetAlignment along the edge and gap in px between trigger and menu. | 'start' | 'center' | 'end' / number | 'center' / 12 |
GlassMenuItem icon / shortcutOptional leading icon and trailing keyboard shortcut hint (e.g. | ReactNode / ReactNode | — |
GlassMenuItem onSelect / disabled / destructiveAction callback, disabled state (skipped by keyboard) and destructive red styling. | () => void / boolean / boolean | — / false / false |
GlassMenuLabel / GlassMenuSeparatorNon-interactive section heading and hairline divider between groups. | div attributes / className | — |
GlassMenuSub / GlassMenuSubTrigger / GlassMenuSubContentNested 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 anaria-label. - Respects reduced motion and falls back to a clean frosted menu without WebGL2.