# Context Menu

Source: https://lumeo.nativ.sh/components/context-menu

# Context Menu

Displays a menu triggered by right-clicking an element.

## Installation

.NET CLI PackageReference Lumeo CLI

dotnet add package Lumeo

One-time app setup (`AddLumeo()`, CSS & JS) is covered in the [installation guide](docs/introduction).

## Usage

@using Lumeo

<ContextMenu />

## When to Use

-   Right-click actions on elements like files, cards, or table rows
-   Custom context menus replacing the browser default for specific areas
-   Element-specific operations such as copy, edit, delete, or move

Preview Code

Default

Right click here

Preview Code

With Labels and Groups

Right click here

Preview Code

File Actions

document.pdf

Right click for options

**Mobile (rc.49).** Context menus now open on a long-press (500 ms by default) on touch devices; use `LongPressMs` to adjust the delay and `MoveTolerancePx` (default 10) to set how far a finger may drift before the press is cancelled.

## Submenus

Nest menus with the `ContextMenuSub` / `ContextMenuSubTrigger` / `ContextMenuSubContent` triplet. Submenus open on hover (with intent delay), and nesting is recursive so you can build deep right-click trees.

Preview Code

Submenus

Right-click me

Keyboard:

-   ArrowRight on a `SubTrigger` opens the submenu and focuses its first item.
-   ArrowLeft closes the current submenu and returns focus to the parent trigger.
-   Escape closes the entire context menu, not just the current submenu.

## API Reference

### ContextMenu

Prop

Type

Default

Description

ChildContent

RenderFragment?

null

Trigger and content elements.

Open

bool

false

Controls whether the context menu is visible. Use with @bind-Open.

OpenChanged

EventCallback<bool>

—

Callback invoked when the open state changes.

AdditionalAttributes

Dictionary<string, object>?

null

Additional HTML attributes.

LongPressMs

int

500

Duration in milliseconds a touch must be held before the menu opens (rc.49).

MoveTolerancePx

int

10

How many CSS pixels a finger may drift during a long-press before it is cancelled (rc.49).

IsOpen

bool

false

Obsolete alias for Open; forwards to and from it.

IsOpenChanged

EventCallback<bool>

—

Obsolete alias for OpenChanged; forwards to and from it.

### ContextMenuTrigger

Prop

Type

Default

Description

ChildContent

RenderFragment?

null

The right-clickable area content.

Class

string?

null

Additional CSS classes.

AdditionalAttributes

Dictionary<string, object>?

null

Additional HTML attributes.

### ContextMenuContent

Prop

Type

Default

Description

ChildContent

RenderFragment?

null

Menu items, labels, and separators.

Class

string?

null

Additional CSS classes.

AdditionalAttributes

Dictionary<string, object>?

null

Additional HTML attributes.

### ContextMenuItem

Prop

Type

Default

Description

ChildContent

RenderFragment?

null

Item label content.

OnClick

EventCallback

—

Callback invoked when clicked. Closes the menu after execution.

Disabled

bool

false

Disables the menu item.

Class

string?

null

Additional CSS classes.

AdditionalAttributes

Dictionary<string, object>?

null

Additional HTML attributes.

### ContextMenuCheckboxItem

Prop

Type

Default

Description

ChildContent

RenderFragment?

null

Checkbox item label content.

Checked

bool

false

Whether the item is checked. Use with @bind-Checked.

CheckedChanged

EventCallback<bool>

—

Callback invoked when the checked state changes.

Class

string?

null

Additional CSS classes.

AdditionalAttributes

Dictionary<string, object>?

null

Additional HTML attributes.

### ContextMenuRadioGroup

Prop

Type

Default

Description

ChildContent

RenderFragment?

null

Radio items.

Value

string?

null

Currently selected value. Use with @bind-Value.

ValueChanged

EventCallback<string>

—

Callback invoked when the selected value changes.

AdditionalAttributes

Dictionary<string, object>?

null

Additional HTML attributes.

### ContextMenuRadioItem

Prop

Type

Default

Description

ChildContent

RenderFragment?

null

Radio item label content.

Value

string

""

The value this radio item represents. Required.

Class

string?

null

Additional CSS classes.

AdditionalAttributes

Dictionary<string, object>?

null

Additional HTML attributes.

### ContextMenuLabel

Prop

Type

Default

Description

ChildContent

RenderFragment?

null

Label text content.

Class

string?

null

Additional CSS classes.

AdditionalAttributes

Dictionary<string, object>?

null

Additional HTML attributes.

### ContextMenuSeparator

Prop

Type

Default

Description

Class

string?

null

Additional CSS classes.

AdditionalAttributes

Dictionary<string, object>?

null

Additional HTML attributes.

### ContextMenuGroup

Prop

Type

Default

Description

ChildContent

RenderFragment?

null

Group items.

Class

string?

null

Additional CSS classes.

AdditionalAttributes

Dictionary<string, object>?

null

Additional HTML attributes.

## Related Components

-   [DropdownMenu](/components/dropdown-menu) — For action menus triggered by a click on a button or icon
-   [Menubar](/components/menubar) — For persistent application menu bars with multiple dropdown menus
-   [Popover](/components/popover) — For displaying arbitrary content in a floating panel on click
