Rate this page:

ContentAction

The ContentAction component renders content in a modal dialog when triggered from the more actions (...) menu. ContentAction is the top-level component required for the confluence:contentAction module.

This module can only be used in Confluence.

Limitation: We discovered that api.asUser() doesn't show the OAuth consent prompt. We are working on a fix for this issue. As a temporary workaround, you can try authorizing with another module type (for example macro).

Usage

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

Props

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

Example

A hello world example of the ContentAction component.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import ForgeUI, {render, Text, ContentAction, ModalDialog, useState} from '@forge/ui';

const App = () => {
    const [isOpen, setOpen] = useState(true)

    if (!isOpen) {
        return null;
    }

    return (
        <ModalDialog header="Hello" onClose={() => setOpen(false)}>
            <Text>Hello world</Text>
        </ModalDialog>
    );
};

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

Preview

Example of a Content action with the above sample code

In more actions menu

Example of a Content action button

Rate this page: