Xzero UI
Pro library

Dropdown menu

A focused list of actions anchored to a trigger.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/dropdown-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/dropdown-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 { DropdownMenu } from "@/components/xzero/dropdown-menu/dropdown-menu";
import { Pencil, Copy, Trash2 } from "lucide-react";

export function ProjectActions() {
  return (
    <DropdownMenu
      label="Actions"
      items={[
        { label: "Rename", icon: <Pencil size={15} />, onSelect: rename },
        { label: "Duplicate", icon: <Copy size={15} />, onSelect: duplicate },
        { label: "Delete", icon: <Trash2 size={15} />, onSelect: remove, destructive: true, separatorBefore: true },
      ]}
    />
  );
}

API reference

DropdownMenu

A labelled trigger that opens a Radix menu with a single highlight gliding between items.

PropTypeDefaultDescription
label (required)string–Trigger text. A new label rises in while the trigger width springs.
items (required)DropdownItem[]–Items: { label, onSelect?, disabled?, icon?, destructive?, separatorBefore? }. Labels double as keys, so keep them unique.
iconReactNode–Leading icon in the trigger.

Keyboard interactions

KeysAction
Enter / Space / ArrowDownOpens the menu from the trigger.
ArrowDown / ArrowUpMoves between items, looping at the ends.
Home / EndJumps to the first or last item.
EscapeCloses the menu and returns focus to the trigger.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Guidance for AI tools

Dropdown menu: A focused list of actions anchored to a trigger. 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