The actionType
property specifies how an action is executed by an app and can be utilized by
supported action modules. An action is a task that executed by an app when a
user selects the app menu item. When declaring actionType
, there are two options:
modal
(default)`, which displays the app's content within a modal.
dynamic
, which allows for programmatic decision-making at runtime to determine how the action is
executed and rendered. With this flexibility, you can perform asynchronous actions, such as exporting
data, and have control over the UI components utilized in the application, such as maintaining multiple
React portal UI components throughout the application lifecycle.
modal
displays the app's content within a modal, with the size determined by the viewportSize
property in the manifest file. As modal
is the default behavior for action modules, if
actionType
is not defined, modal
will be used. This behavior is consistent with existing
modules, including jira:issueAction
and confluence:contentAction,
where the app is always rendered within a modal.
Use cases for modal
include:
dynamic
allows for programmatic decision-making at runtime regarding the execution or rendering of
the application.
While dynamic
offers the flexibility to implement non-UI actions, such as exporting data, when
using it to trigger something the user cannot see, it is recommended to include a UI element to
inform users about the status or outcome of the action. This improves the user experience by clearly
communicating the action and outcomes. You can use UI elements that render in a React portal, such
as a flag.
Use cases for dynamic
include:
Asynchronous workloads that don’t require additional user input, such as exporting data.
Tasks that require more flexibility or control over the UI components utilized in the application. This could include:
Using a UI Kit Modal instead of the default modal
so that you can specify the modal properties directly at runtime.
Maintaining multiple UI components throughout the application lifecycle. For example, configuring a report setup in a smaller modal and subsequently displaying the report in a full-screen modal after configuration.
modal
displays the app contents directly in a modal, so you don't need to use the
UI Kit modal component. Modal closing is also managed
by default so there is no need to explicitly call view.close()
to terminate the application.
1 2import React from 'react'; import ForgeReconciler, { Text } from '@forge/react'; import { view } from '@forge/bridge'; const App = () => { return <Text>App Content</Text>; }; ForgeReconciler.render( <React.StrictMode> <App /> </React.StrictMode> );
As dynamic
does not have a pre-configured UI element, app content will not be rendered visibly
by default. Any app content that you would like to appear in the UI needs to be configured with
the relevant UI element, such as a UI Kit modal or a
flag.
When using dynamic
, view.close() should be called to properly terminate the Forge app. For example, if the app uses a UI Kit modal, the modal’s onClose handler should call view.close() to close the app properly.
1 2import React from 'react'; import ForgeReconciler, { Modal, ModalTransition, Button, Text } from '@forge/react'; import { view, showFlag } from '@forge/bridge'; const App = () => { const displayFlag = () => { showFlag({ id: 'hello-world', title: 'Hello World', type: 'info', description: 'hi', }); }; return ( <ModalTransition> <Modal onClose={() => view.close()}> <Text>App Content</Text> <Button onClick={displayFlag}>Display Flag</Button> </Modal> </ModalTransition> ); }; ForgeReconciler.render( <React.StrictMode> <App /> </React.StrictMode> );
actionType
can be utilized by the following modules:
Jira project stats app
This example app uses the Jira backlog action and Jira board action modules to add items to the more actions menu of the Jira board and backlog views.
Rate this page: