Rate this page:

ContextMenu

The ContextMenu component renders content in an inline dialog when triggered from the context menu. The context menu shows when a user selects some text. ContextMenu is the top-level component required for the confluence:contextMenu module.

This module can only be used in Confluence.

Usage

1
import ForgeUI, { ContextMenu } from '@forge/ui';

Props

NameTypeRequiredDescription
childrenArray<ForgeComponent>YesA container for displaying multiple components. Can only contain InlineDialog.

Example

A hello world example of the ContextMenu component.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import ForgeUI, { render, Text, ContextMenu, InlineDialog } from '@forge/ui';

const App = () => {
    return (
        <InlineDialog>
            <Text>Hello world!</Text>
        </InlineDialog>
    );
};

export const run = render(
    <ContextMenu>
        <App/>
    </ContextMenu>
);

Preview

Example of a Context menu with the above sample code

In context menu

Example of a Context menu button

Rate this page: