The confluence:contextMenu module displays an
entry in the context menu
when a user selects some text on a page or blog. The title in each confluence:contextMenu module section (from
every installed app's manifest file) will render as a separate menu item under the dropdown menu. When a user clicks
the context menu item, the Forge app renders in an inline dialog.
The selected text is passed to the Forge app as a part of extensionContext, and
is retrieved using the useProductContext hook.
On apps that use Custom UI, module content is displayed inside a special Forge iframe which has the sandbox attribute configured. This means that HTML links (for example, <a href="https://domain.tld/path">...</a>) in this iframe won't be clickable. To make them clickable, use the router.navigate API from the @forge/bridge package.

| Property | Type | Required | Description |
|---|---|---|---|
key |
| Yes |
A key for the module, which other modules can refer to. Must be unique within the manifest. Regex: |
resource | string | If using Custom UI or modern versions of UI Kit | The key of a static resources entry that your module will display. See resources for more details. |
render | 'native' | If using modern versions of UI Kit | Indicates the module uses UI Kit. |
resolver | { function: string } or{ endpoint: string } |
Set the Set the | |
viewportSize | 'small', 'medium' or 'large' | The display size of resource. Can only be set if the module is using the resource property. Remove this property to enable automatic resizing of the module. | |
title | string or i18n object | Yes |
The title of the context menu module, displayed as a menu item. The |
description | string or i18n object |
The description of the context menu app. The | |
displayConditions | object | The object that defines whether or not a module is displayed in the UI of the app. See display conditions. | |
keyboardShortcut | object | The object that defines a keyboard shortcut to trigger this module. See keyboard shortcuts. | |
unlicensedAccess | List<string> |
A list of unlicensed user types that can access this module. Valid values are: unlicensed (Guests Users), and anonymous. For more information, see
Access to Forge apps for unlicensed Confluence users.
|
| Key | Type | Required | Description |
|---|---|---|---|
i18n | string | Yes | A key referencing a translated string in the translation files. For more details, see Translations. |
This module can also be declared as a dynamic module. However, this capability is currently available as a Forge preview feature.
For more details, see Dynamic Modules.
When you register a dynamic confluence:contextMenu module, the data object uses the same properties as a static confluence:contextMenu module in the manifest. The module key is provided as a top-level property in the Dynamic Modules API payload.
The following examples show Dynamic Module implementations specific to this module. For more detailed information about the API used in these examples (including error handling information), see Dynamic Modules API.
1 2import { asApp } from "@forge/api"; const payload = { "type": "confluence:contextMenu", "data": { "resolver": { "function": "resolver" }, "resource": "main", "render": "native", "title": "Dynamic context menu", "description": "Runs against selected text" } } const response = await asApp().requestAtlassian(`/forge/installation/v2/dynamic/module/`, { headers: { 'Content-Type': 'application/json' }, method: 'POST', body: JSON.stringify(payload), }); const body = await response.text(); console.log(`Response: ${response.status} ${body}`);
1 2import { asApp } from "@forge/api"; const key = "context-menu-dynamic"; const payload = { "type": "confluence:contextMenu", "data": { "resolver": { "function": "resolver" }, "resource": "main", "render": "native", "title": "Updated dynamic context menu", "description": "Runs against selected text" } } const response = await asApp().requestAtlassian(`/forge/installation/v2/dynamic/module/${key}`, { headers: { 'Content-Type': 'application/json' }, method: 'PUT', body: JSON.stringify(payload) }); const body = await response.text(); console.log(`Response: ${response.status} ${body}`);
Use the useProductContext hook to access the extension context in UI Kit or getContext bridge method in Custom UI.
| Property | Type | Description |
|---|---|---|
type | string | The type of the module. |
selectedText | string | The text selected on a page or a blog for which context menu is opened. |
content.id | string | A string that represents the unique identifier of the content object. |
content.type | "page", "blogpost" or "space" | A string that represents the unique key of the content object. |
content.subtype | string or null | A string that represents the subtype of the content object. null is returned if subtype does not apply. |
space.id | string | A string that represents the unique identifier of the space object. |
space.key | string | A string that represents the unique key of the space object. |
location | string | The full URL of the host page where this module is displayed. |
Rate this page: