Skip to main content

Content Manager APIs

Page summary:

Content Manager APIs add panels and actions to list or edit views through addEditViewSidePanel, addDocumentAction, addDocumentHeaderAction, or addBulkAction. Each API accepts component functions with typed contexts, enabling precise control over document-aware UI injections.

Content Manager APIs are part of the Admin Panel API. They are a way for Strapi plugins to add content or options to the Content Manager. The Content Manager APIs allow you to extend the Content Manager by adding functionality from your own plugin, just like you can do it with Injection zones.

Prerequisites

Before diving deeper into the concepts on this page, please ensure you have:

General information

Strapi 5 provides 4 Content Manager APIs, all accessible through app.getPlugin('content-manager').apis. All the Content Manager APIs share the same API shape and must use components.

Injection zones vs. Content Manager APIs

tl;dr

For adding panels, actions, or buttons to the Content Manager, the Content Manager APIs (addDocumentAction, addEditViewSidePanel, etc.) are often more robust and better typed than injection zones. Use injection zones when you need to insert components into specific UI areas not covered by the Content Manager APIs.

Content Manager APIs and injection zones are both extension points to customize the admin panel, but they solve different needs:

NeedRecommended APIWhy
Add a custom panel in the Edit View side areaContent Manager API (addEditViewSidePanel)Best for contextual information or controls that stay visible while editing.
Add actions in a document action menuContent Manager API (addDocumentAction)Best for document-level actions in the Edit View actions menu.
Add actions in the Edit View headerContent Manager API (addDocumentHeaderAction)Best for quick, prominent actions next to the document title.
Add actions for selected entries in List ViewContent Manager API (addBulkAction)Best for workflows that apply to multiple entries at once.
Add UI to a predefined zone in a plugin view (localized visual customization)Injection Zones API (injectComponent)Best when you target a specific zone exposed by a plugin.

For implementation details and up-to-date API signatures, please refer to the content-manager file in the Strapi codebase.

Mini examples (inside bootstrap(app))

// Document action menu item
app.getPlugin('content-manager').apis.addDocumentAction(() => ({
label: 'Run custom action',
onClick: ({ documentId }) => runCustomAction(documentId),
}));

// Edit View header action
app.getPlugin('content-manager').apis.addDocumentHeaderAction(() => ({
label: 'Open preview',
onClick: ({ document }) => openPreview(document),
}));

// List View bulk action
app.getPlugin('content-manager').apis.addBulkAction(() => ({
label: 'Bulk publish',
onClick: ({ documentIds }) => bulkPublish(documentIds),
}));

// Edit View side panel
app.getPlugin('content-manager').apis.addEditViewSidePanel([
{
name: 'my-plugin.side-panel',
Component: MySidePanel,
},
]);

// Injection zone (plugin-defined zone)
app.injectContentManagerComponent('editView', 'right-links', {
name: 'my-plugin.custom-link',
Component: MyCustomLink,
});

API shape

All Content Manager APIs works in the same way: to use them, call them on your plugin's bootstrap() function, in 2 possible ways:

Note

When using TypeScript, the apis property returned by app.getPlugin() is typed as unknown. Cast it to ContentManagerPlugin['config']['apis'] before calling the APIs.

  • Passing an array with what you want to add. For example, the following code would add the ReleasesPanel at the end of the current EditViewSidePanels:

    const apis = app.getPlugin('content-manager').apis;

    apis.addEditViewSidePanel([ReleasesPanel]);
  • Passing a function that receives the current elements and return the new ones. This is useful if, for example, you want to add something in a specific position in the list, like in the following code:

    const apis = app.getPlugin('content-manager').apis;

    apis.addEditViewSidePanel((panels) => [SuperImportantPanel, ...panels]);

Components

You need to pass components to the API in order to add things to the Content Manager.

Components are functions that receive some properties and return an object with some shape (depending on the function). Each component's return object is different based on the function you're using, but they receive similar properties, depending on whether you use a ListView or EditView API.

Properties include important information about the document(s) you are viewing or editing.

ListViewContext

interface ListViewContext {
/**
* Will be either 'single-types' | 'collection-types'
*/
collectionType: string;
/**
* The current selected documents in the table
*/
documents: Document[];
/**
* The current content-type's model.
*/
model: string;
}

EditViewContext

interface EditViewContext {
/**
* This will only be null if the content-type
* does not have draft & publish enabled.
*/
activeTab: 'draft' | 'published' | null;
/**
* Will be either 'single-types' | 'collection-types'
*/
collectionType: string;
/**
* Will be undefined if someone is creating an entry.
*/
document?: Document;
/**
* Will be undefined if someone is creating an entry.
*/
documentId?: string;
/**
* Will be undefined if someone is creating an entry.
*/
meta?: DocumentMetadata;
/**
* The current content-type's model.
*/
model: string;
}
Tip

More information about types and APIs can be found in Strapi's codebase, in the `/admin/src/content-manager.ts` file.

Example:

Adding a panel to the sidebar can be done as follows:

my-plugin/components/my-panel.js
const Panel = ({ 
activeTab,
collectionType,
document,
documentId,
meta,
model
}) => {
return {
title: 'My Panel',
content: <p>I'm on {activeTab}</p>
}
}

Available APIs


addEditViewSidePanel

Use this to add new panels to the Edit view sidebar, just like in the following example where something is added to the Releases panel:

addEditViewSidePanel

addEditViewSidePanel(panels: DescriptionReducer<PanelComponent> | PanelComponent[])

PanelComponent

A PanelComponent receives the properties listed in EditViewContext and returns an object with the following shape:

type PanelComponent = (props: PanelComponentProps) => {
title: string;
content: React.ReactNode;
};

PanelComponentProps extends the EditViewContext.

addDocumentAction

Use this API to add more actions to the Edit view or the List View of the Content Manager. There are 3 positions available:

  • header of the Edit view:

    Header of the Edit view

  • panel of the Edit view:

    Panel of the Edit View

  • table-row of the List view:

    Table-row in the List View

addDocumentAction(actions: DescriptionReducer<DocumentActionComponent> | DocumentActionComponent[])

DocumentActionDescription

The interface and properties of the API look like the following:

interface DocumentActionDescription {
label: string;
onClick?: (event: React.SyntheticEvent) => Promise<boolean | void> | boolean | void;
icon?: React.ReactNode;
/**
* @default false
*/
disabled?: boolean;
/**
* @default 'panel'
* @description Where the action should be rendered.
*/
position?: DocumentActionPosition | DocumentActionPosition[];
dialog?: DialogOptions | NotificationOptions | ModalOptions;
/**
* @default 'secondary'
*/
variant?: ButtonProps['variant'];
loading?: ButtonProps['loading'];
}

type DocumentActionPosition = 'panel' | 'header' | 'table-row' | 'preview' | 'relation-modal';

interface DialogOptions {
type: 'dialog';
title: string;
content?: React.ReactNode;
variant?: ButtonProps['variant'];
onConfirm?: () => void | Promise<void>;
onCancel?: () => void | Promise<void>;
}
interface NotificationOptions {
type: 'notification';
title: string;
link?: {
label: string;
url: string;
target?: string;
};
content?: string;
onClose?: () => void;
status?: NotificationConfig['type'];
timeout?: number;
}
interface ModalOptions {
type: 'modal';
title: string;
content: React.ComponentType<{
onClose: () => void;
}> | React.ReactNode;
footer?: React.ComponentType<{
onClose: () => void;
}> | React.ReactNode;
onClose?: () => void;
}

addDocumentHeaderAction

Use this API to add more actions to the header of the Edit view of the Content Manager:

addEditViewSidePanel

addDocumentHeaderAction(actions: DescriptionReducer<HeaderActionComponent> | HeaderActionComponent[])

HeaderActionDescription

The interface and properties of the API look like the following:

interface HeaderActionDescription {
disabled?: boolean;
label: string;
icon?: React.ReactNode;
type?: 'icon' | 'default';
onClick?: (event: React.SyntheticEvent) => Promise<boolean | void> | boolean | void;
dialog?: DialogOptions;
options?: Array<{
disabled?: boolean;
label: string;
startIcon?: React.ReactNode;
textValue?: string;
value: string;
}>;
onSelect?: (value: string) => void;
value?: string;
}

interface DialogOptions {
type: 'dialog';
title: string;
content?: React.ReactNode;
footer?: React.ReactNode;
}

addBulkAction

Use this API to add buttons that show up when entries are selected on the List View of the Content Manager, just like the "Add to Release" button for instance:

addEditViewSidePanel

addBulkAction(actions: DescriptionReducer<BulkActionComponent> | BulkActionComponent[])

BulkActionDescription

The interface and properties of the API look like the following:

interface BulkActionDescription {
dialog?: DialogOptions | NotificationOptions | ModalOptions;
disabled?: boolean;
icon?: React.ReactNode;
label: string;
onClick?: (event: React.SyntheticEvent) => void;
/**
* @default 'default'
*/
type?: 'icon' | 'default';
/**
* @default 'secondary'
*/
variant?: ButtonProps['variant'];
}