Skip to main content


ContextMenu is a module to help patch and create context menus. Instance is accessible through the BdApi.




Builds a single menu item. The only prop shown here is the type, the rest should match the actual component being built. View those to see what options exist for each, they often have less in common than you might think.

propsobjectnoneprops used to build the item
props.typestring"text"type of the item, options: text, submenu, toggle, radio, custom, separator

Returns: object - the created component


Creates the menu component including the wrapping ContextMenu. Calls {@link ContextMenu.buildMenuChildren} under the covers. Used to call in combination with {@link}.

setupArray.<object>array of item props used to build items. See {@link ContextMenu.buildMenuChildren}

Returns: function - the unique context menu component


Creates the all the items and groups of a context menu recursively. There is no hard limit to the number of groups within groups or number of items in a menu.

setupArray.<object>array of item props used to build items. See {@link ContextMenu.buildItem}

Returns: Array.<object> - array of the created component


Closes the current opened context menu immediately.

Returns: void


Function that allows you to open an entire context menu. Recommended to build the menu with this module.

eventMouseEventnoneThe context menu event. This can be emulated, requires target, and all X, Y locations.
menuComponentfunctionnoneComponent to render. This can be any react component or output of {@link ContextMenu.buildMenu}
configobjectnoneconfiguration/props for the context menu
config.positionstring"right"default position for the menu, options: "left", "right"
config.alignstring"top"default alignment for the menu, options: "bottom", "top"
config.onClosefunctionnonefunction to run when the menu is closed
config.noBlurEventbooleanfalseNo clue

Returns: void


Allows you to patch a given context menu. Acts as a wrapper around the Patcher.

navIdstringDiscord's internal navId used to identify context menus
callbackfunctioncallback function that accepts the react render tree

Returns: function - a function that automatically unpatches


Allows you to remove the patch added to a given context menu.

navIdstringthe original navId from patching
callbackfunctionthe original callback from patching

Returns: void