# file-manager-custom-context-menu-item

> File manager context menu with an added Custom item that runs its own handler when clicked.

**Framework:** react  **Component:** FileManager  **Variant:** custom-context-menu-item

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/react/ts/file-manager-custom-context-menu-item.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-react-filemanager
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/file-manager-custom-context-menu-item/FileManager.tsx

```tsx
import { DetailsView, FileManagerComponent, NavigationPane, Toolbar, Inject, type ViewType } from '@syncfusion/ej2-react-filemanager';

/**
 * File Manager custom context menu item sample
 */
const CustomContextMenuItem = () => {
  let fileObj: FileManagerComponent;
  let hostUrl: string = "https://physical-service.syncfusion.com/";
  let ajaxSettings: object = {
    downloadUrl: hostUrl + 'api/FileManager/Download',
    getImageUrl: hostUrl + "api/FileManager/GetImage",
    uploadUrl: hostUrl + 'api/FileManager/Upload',
    url: hostUrl + "api/FileManager/FileOperations"
  };
  let contextMenuSettings: object = {
    file: ['Open', '|', 'Delete', 'Rename', '|', 'Details', 'Custom'],
    folder: ['Open', '|', 'Delete', 'Rename', '|', 'Details', 'Custom'],
    layout: ['SortBy', 'View', 'Refresh', '|', 'NewFolder', 'Upload', '|', 'Details', '|', 'SelectAll', 'Custom'],
  };
  let height: string = "375px";
  let view: ViewType = "Details";
  function menuClick(args: any): void {
    if (args.item.text === 'Custom') {
        alert('You have clicked custom menu item')
    }
  }

  function menuOpen(args: any): void {
    for(const i in args.items) {
        if(args.items[i].id === fileObj.element.id +'_cm_custom') {
            args.items[i].iconCss= 'e-icons e-fe-tick';
        }
    }
  }

  return (
  <div>
      <div className="control-section">
        <FileManagerComponent ref={ (s: FileManagerComponent | null) => { fileObj = s as FileManagerComponent; }} id="file" height={height} view={view}
          ajaxSettings={ajaxSettings}
          contextMenuSettings={contextMenuSettings}
          menuClick={menuClick} menuOpen={menuOpen} >
              <Inject services={[ NavigationPane, DetailsView, Toolbar]} />
          </FileManagerComponent>
      </div>
  </div>
  );
}
export default CustomContextMenuItem;

```
