Xzero UI
Pro library

Glass menuPro

A glass action menu whose trigger morphs into the panel, with a highlight pill that glides between rows, one in-place submenu, and full keyboard support.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/glass-menu
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/glass-menu

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Copy, FolderInput, Trash2 } from "lucide-react";
import { GlassMenu } from "@/components/xzero/glass-menu/glass-menu";

export function PhotoActions() {
  return (
    <GlassMenu
      label="Photo actions"
      onSelect={id => console.log(id)}
      groups={[
        { id: "edit", items: [
          { id: "duplicate", label: "Duplicate", icon: <Copy size={16} />, shortcut: "⌘D" },
          { id: "move", label: "Move to", icon: <FolderInput size={16} />, items: [
            { id: "lisbon", label: "Lisbon trip" },
            { id: "archive", label: "Archive" },
          ] },
        ] },
        { id: "danger", items: [{ id: "delete", label: "Delete", icon: <Trash2 size={16} />, danger: true }] },
      ]}
    >
      Pool house
    </GlassMenu>
  );
}

API reference

GlassMenu

A glass action menu. The trigger morphs into the panel on a spring, a glass pill slides between rows, one submenu slides in place, and the panel morphs back into the trigger on close.

PropTypeDefaultDescription
groups (required)GlassMenuGroup[]–Rows in groups: { id, label?, items }. Groups are separated by a hairline; label adds a quiet heading.
children (required)ReactNode–Trigger content, usually a short label and a chevron or an icon.
labelstring"Actions"Accessible name of the menu.
triggerLabelstring–Accessible name of the trigger when it only shows an icon.
openboolean–Controlled open state.
defaultOpenbooleanfalseInitial open state when uncontrolled.
onOpenChange(open: boolean) => void–Called when the menu opens or closes.
onSelect(id: string, item: GlassMenuItem) => void–Called with the chosen row. Rows with items open their submenu instead.
align"start" | "end""start"Which edge of the trigger the panel grows from.
widthnumber256Panel width in px, capped to the viewport.
classNamestring–Extra class on the root.
styleCSSProperties–Inline styles on the root.

GlassMenuItem

One row.

PropTypeDefaultDescription
id (required)string–Stable id passed to onSelect.
label (required)string–Row text. Also used for typeahead.
iconReactNode–A 16px icon. It takes the accent color while the row is highlighted.
shortcutstring–Shortcut hint on the right, such as "⌘D". Display only.
checkedboolean–Makes the row a checkbox item with an accent check. Leave undefined for plain actions.
dangerboolean–Uses the danger color for destructive actions.
disabledboolean–Skipped by the keyboard and ignores clicks.
itemsGlassMenuItem[]–Nested rows. The submenu slides in place with a back row, one level deep.
keepOpenboolean–Keeps the menu open after the row is chosen. Handy for checkable rows.

Keyboard interactions

KeysAction
Enter / Space / ArrowDownOn the trigger, open the menu with the first row highlighted.
ArrowUpOn the trigger, open the menu with the last row highlighted.
ArrowDown / ArrowUpMove the highlight, skipping disabled rows and wrapping at the ends.
Home / EndJump to the first or last row.
Enter / SpaceChoose the highlighted row, or open its submenu.
ArrowRightOpen the submenu of the highlighted row.
ArrowLeftIn a submenu, go back to the parent row.
EscapeLeave the submenu, or close the menu and return focus to the trigger.
TabClose the menu and return focus to the trigger.
LettersTypeahead: jump to the next row whose label starts with what you type.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in glass

Guidance for AI tools

Glass menu: A glass action menu whose trigger morphs into the panel, with a highlight pill that glides between rows, one in-place submenu, and full keyboard support. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components