Action menu
A compact button-triggered menu with grouped actions, shortcuts, and danger states.
Implementation
1"use client";2 3import {4 useEffect,5 useId,6 useRef,7 useState,8 type HTMLAttributes,9 type KeyboardEvent,10 type ReactNode,11} from "react";12import { Check, MoreHorizontal } from "lucide-react";13 14export type ActionMenuItem = {15 id: string;16 label: string;17 description?: string;18 /** Display only, for example ⌘K. The component does not bind it. */19 shortcut?: string;20 icon?: ReactNode;21 danger?: boolean;22 disabled?: boolean;23 /** Shows a check mark for the current choice. */24 selected?: boolean;25 onSelect?: () => void;26};27 28export type ActionMenuGroup = {