--- title: Implement a Context Menu in the Grid description: 'Learn how to add a context menu to a KendoReact Grid.' type: how-to page_title: Add a Context Menu - KendoReact Grid slug: grid-context-menu tags: grid, kendoreact, contextmenu ticketid: 1422874 res_type: kb category: knowledge-base components: ["grid"] --- ## Environment
Product Version 3.15.0
Product Progress® KendoReact Grid
## Description How to add a context menu to the Grid? ## Solution You can implement a context menu in the Grid by using the [KendoReact Popup component]({% slug overview_popup %}) and then and display it on a right click. 1. Attach the `onContextMenu` to the Grid rows and pass the row data to the context menu by utilizing the [`rowRender`]({% slug api_grid_gridprops %}) property (derecated as of v10.0.0). ```tsx-no-run rowRender = (trElement, dataItem) => { const trProps = { ...trElement.props, onContextMenu: (e) => { e.preventDefault() this.handleContextMenuOpen(e, dataItem.dataItem) } }; return React.cloneElement(trElement, { ...trProps }, trElement.props.children); } ``` 2. Define the desired content of the context menu in the Popup. As the elements inside the Popup are custom, they execute different actions depending on the desired functionality. ```tsx-no-run ``` The following example demonstrates the full implementation of the suggested approach. The context menu provides options for moving the rows up and down, and for deleting an item. {% meta height:480 %} {% embed_file grid/context-menu/app.tsx preview %} {% embed_file grid/context-menu/main.tsx %} {% endmeta %}