Context Menu Component

Displays a menu to the user — such as a set of actions or functions — triggered by right-clicking.

Default

Right-click the area below to open the context menu.

Right click here

With Icons

Add Lucide icons to menu items for better visual hierarchy.

Right click for icon menu

With Labels and Groups

Organize menu items into groups with labels.

Right click for file actions

With Destructive Item

Highlight dangerous actions with custom styling.

Right click on this card

With Inset Items

Use inset for items without icons to align with other items.

Right click here

On Image

Context menu on an image element.

Photo

Features

  • Opens on right-click (contextmenu event)
  • Positioned at mouse cursor location
  • Closes on outside click or Escape key
  • Full keyboard navigation (↑/↓, Enter, Escape)
  • Support for disabled items
  • Keyboard shortcut hints
  • Separator and label components

Keyboard Navigation

↑/↓ Navigate items
Enter/Space Select item
Escape Close menu

Installation

@using BlazorUI.Components.ContextMenu

Usage

<ContextMenu>
    <ContextMenuTrigger>
        <div>Right click here</div>
    </ContextMenuTrigger>
    <ContextMenuContent>
        <ContextMenuItem OnClick="HandleCopy">
            Copy
            <ContextMenuShortcut>⌘C</ContextMenuShortcut>
        </ContextMenuItem>
        <ContextMenuSeparator />
        <ContextMenuItem>Delete</ContextMenuItem>
    </ContextMenuContent>
</ContextMenu>

With Checkbox Items

Toggle preferences directly from the context menu.

Right click for view options
Hidden: Hidden Extensions: Shown Compact: No

With Radio Items

Select from mutually exclusive options.

Right click to select sort order

Sort order: name

With Submenus

Organize complex options in nested menus.

Right click for share options
An unhandled error has occurred. Reload 🗙