The Forge global:ui module is now in Preview, and therefore fully supported. However, it remains under active development and may be subject to shorter deprecation windows. Preview features are suitable for early adopters in production environments.
The global:ui module currently supports only UI Kit (render: native).
Atlassian releases preview features so partners and developers can study, test, and integrate them before General Availability (GA). For more details, see Forge EAP, Preview, and GA.
The panel object enables your app to open a resource in a side panel on the right-hand side of
the page, alongside your app's main content.
The panel bridge API is only supported in the global:ui module.
You can call it from your global:ui UI Kit code and from Custom UI resources rendered inside the
module, such as a Frame.
1 2 3 4 5 6 7 8 9 10 11 12 13interface PanelOptions { resource: string; render?: 'native'; onClose?: () => void; title?: string; icon?: string; } const panel: { open: (opts: PanelOptions) => Promise<void>; close: () => Promise<void>; };
open again replaces it.panel.open.Both methods throw a BridgeAPIError if the panel can't be opened or closed.
<resource-key>/<entry-key> syntax. See
Resources — Multiple entry points.'native' when the resource is a UI Kit resource. Omit it for Custom UI resources.panel.open call.global:ui
module is used.The panel always renders a header containing the title, the icon, and a close button.
Inside the panel resource, call view.close() or panel.close() to close the panel. Both close the
panel and call the onClose callback. Any payload passed to view.close() is ignored.
The following example demonstrates opening a Custom UI resource, with index.tsx as the parent resource, and my-panel-resource.tsx as the custom UI resource.
index.tsx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36import React from 'react'; import ForgeReconciler, { Button } from '@forge/react'; import { panel } from '@forge/bridge'; import { Global, Sidebar, LinkMenuItem, Main } from '@forge/react/global'; const App = () => { const openPanel = () => panel .open({ resource: 'my-panel-resource', onClose: () => { console.log('Panel closed'); }, title: 'Activity', icon: './icon.png', }) .catch((error) => console.error('Failed to open panel', error)); return ( <Global> <Sidebar> <LinkMenuItem label="Overview" href="/overview" /> </Sidebar> <Main> <Button onClick={openPanel}>Show activity</Button> </Main> </Global> ); }; ForgeReconciler.render( <React.StrictMode> <App /> </React.StrictMode> );
my-panel-resource.tsx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19import React from 'react'; import { view } from '@forge/bridge'; const App = () => { const closePanel = () => view .close() .catch((error) => console.error('Failed to close panel', error)); return ( <div> <p>No recent activity.</p> <button onClick={closePanel}>Close</button> </div> ); }; export default App;
The following example demonstrates opening a UI Kit resource, with index.tsx as the parent resource, and help-panel.tsx as the UI Kit resource.
A UI Kit panel resource must be declared as an entry of a multi-entry resource, using the
entry property. You can't
open a standalone UI Kit resource in a panel. Reference the entry using the
<resource-key>/<entry-key> syntax, such as main/help-panel.
manifest.yml
1 2 3 4 5 6 7 8 9 10 11 12 13modules: global:ui: - key: my-global-app resource: main/app render: native title: My app resources: - key: main path: src/frontend entry: app: index.tsx help-panel: help-panel.tsx
index.tsx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36import React from 'react'; import ForgeReconciler, { Button } from '@forge/react'; import { panel } from '@forge/bridge'; import { Global, Sidebar, LinkMenuItem, Main } from '@forge/react/global'; const App = () => { const openHelp = async () => { try { await panel.open({ resource: 'main/help-panel', render: 'native', title: 'Help', }); } catch (error) { console.error('Failed to open panel', error); } }; return ( <Global> <Sidebar> <LinkMenuItem label="Overview" href="/overview" /> </Sidebar> <Main> <Button onClick={openHelp}>Help</Button> </Main> </Global> ); }; ForgeReconciler.render( <React.StrictMode> <App /> </React.StrictMode> );
help-panel.tsx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24import React from 'react'; import ForgeReconciler, { Button, Text } from '@forge/react'; import { panel } from '@forge/bridge'; const HelpPanel = () => { const closePanel = () => panel .close() .catch((error) => console.error('Failed to close panel', error)); return ( <> <Text>Find answers to common questions about this app.</Text> <Button onClick={closePanel}>Close</Button> </> ); }; ForgeReconciler.render( <React.StrictMode> <HelpPanel /> </React.StrictMode> );
Rate this page: