Start here
  • InstallationAdd Nelumbo to a shadcn project
  • ThemingBrand accent, neutrals, dynamic color
  • Biology componentsSequences, maps, plates and trees
  • katalyx.bio

    Context Menu

    A menu of actions for the thing under the pointer. It springs open from where you clicked, shares its rows with the Dropdown Menu, and a raised pill slides between them as you move.

    Install

    npx shadcn@latest add @nelumbo/context-menu

    Actions

    Right-click the area. On touch, press and hold; on a keyboard, focus it and press Shift+F10 or the Menu key. Icons on the left, keycap shortcuts on the right, a submenu, and a destructive action set apart at the end.

    Right-click, long-press, or press Shift+F10Nothing chosen yet

    Options

    Checkbox items toggle without closing the menu; a radio group picks one, and the chosen row fills in with the tonal container.

    View options (grid on, rulers off, 100%)

    Usage

    import { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuShortcut, ContextMenuSeparator } from "@/components/ui/context-menu"​<ContextMenu>  <ContextMenuTrigger className="grid h-40 place-items-center rounded-2xl bg-surface-container-high">    Right-click here  </ContextMenuTrigger>  <ContextMenuContent className="w-60">    <ContextMenuItem>      <Icon name="content_copy" /> Copy <ContextMenuShortcut>⌘C</ContextMenuShortcut>    </ContextMenuItem>    <ContextMenuSeparator />    <ContextMenuItem variant="destructive">      <Icon name="delete" /> Delete    </ContextMenuItem>  </ContextMenuContent></ContextMenu>

    Props

    Everything else is Radix Context Menu (onOpenChange, modal, onSelect, checked, value…). The trigger is not a button: give it tabIndex={0} if keyboard users should reach it, since Shift+F10 and the Menu key open the menu from whatever has focus.

    PropTypeDefaultNotes
    ContextMenuItem variant"default" | "destructive""default"
    insetbooleanfalseItem, Label, SubTrigger: align with items that have an icon
    ContextMenuShortcutstringDrawn as keycaps: "⌘C" and "⌘ C" become two caps