Syncfusion Feedback

Trusted by the world’s leading companies

Syncfusion Trusted Companies

Overview

The React Context Menu is a user interface element that appears upon a right-click or touch-and-hold gesture. It allows you to display menu items, supports nested (multilevel) menus, and allows event handlers to be attached to each item for smooth integration with other components.

React Context menu items with separator


React Context Menu code example

Get started with the React Context Menu using a few simple lines of TSX code, as demonstrated below. Also, explore this React Context Menu demo, which shows how to render and configure the Context Menu in React.

import { ContextMenu, MenuItem } from '@syncfusion/react-navigations';
import { useRef } from 'react';
import { CopyIcon, CutIcon} from '@syncfusion/react-icons';

export default function App() {
    const targetRef = useRef<HTMLImageElement>(null);

    return (
        <div className="component-section">
            <img ref={targetRef} src={'https://react.syncfusion.com/images/tooltip/mountain.png'} alt="Mountain" className='context-menu-image' />
            <ContextMenu targetRef={targetRef as React.RefObject<HTMLElement>}>
                <MenuItem text="Cut" icon={<CutIcon />} />
                <MenuItem text="Copy" icon={<CopyIcon />} />
            </ContextMenu>
        </div>
    );
};

Multilevel menu

The React Context Menu supports multilevel nested items. Submenus can be accessed by hovering over or clicking on menu items. On a desktop, nested items are displayed in multiple layers, while on a mobile device, they appear in a single layer with an option to navigate back to the parent item.

React multilevel context menu


Context menu customization

Icons can be easily included in menu items within the React Context Menu to represent actions visually and enhance user interface clarity. Each element of the menu is customizable, allowing full control over layout, styling, and behavior.

React Context menu with icons


React Context menu integration

Integration with other components

The React Context Menu can be integrated with any component with simple configurations.


Web accessibility

  • Fully supports WAI-ARIA for working with screen readers and assistive devices.
  • Follows WAI-ARIA best practices for implementing keyboard interaction.
  • Follows WCAG 2.0 standards in the design of UI visual elements such as foreground color, background color, line spacing, text, and images.
  • Supports right-to-left (RTL) text rendering for users working in right-to-left languages like Hebrew, Arabic, or Persian.



Pure React Components

Developed using React’s core principles, this library employs functional components and hooks without any external dependencies.

Frequently Asked Questions

  • Easily configurable with other components.
  • Automatic collision detection and handling with submenu flip-and-fit.
  • Option to customize menu items for templating or include other components like Checkbox, Radio Button, etc.
  • Simple configuration and APIs.

  • Supports all modern browsers.
  • Touch-friendly and responsive UI.
  • Expansive learning demoslet you learn quickly and get started with React Context Menu.

Find our React Context Menu demo here, which shows you how to render and configure the Context Menu.

No, this is a commercial product and requires a paid license. However, a free Community License is also available for companies and individuals whose organizations have less than $1 million USD in annual gross revenue, 5 or fewer developers, and 10 or fewer total employees.

A good place to start would be our comprehensive getting started documentation.



Rated by users across the globe

Transform your applications today by downloading our free evaluation version
Download Free Trial No credit card required.

Syncfusion React Context Menu resources

Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion® is proud to hold the following industry awards.

Up arrow icon