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.
@vitrumui/react/menu): four-sided directional morphing (top, right, bottom, left) 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,
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
| 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 | — |
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.