Workspace Action Menu Items
Learn how to create workspace action menu items that extend workspace actions with additional functionality.
Workspace Action Menu Items extend existing workspace actions by adding dropdown menu options. They provide secondary functionality that relates to the primary action without cluttering the workspace footer.
Manifest
{
type: 'workspaceActionMenuItem',
kind: 'default',
alias: 'example.workspaceActionMenuItem.resetCounter',
name: 'Reset Counter Menu Item',
api: () => import('./reset-counter-menu-item.action.js'),
forWorkspaceActions: 'example.workspaceAction.incrementor',
weight: 100,
meta: {
label: 'Reset Counter',
icon: 'icon-refresh',
},
}Key Properties
kind- Specifies which type of element should be shown (if noelementis provided). Thedefaultoption refers to the<umb-workspace-action-menu-item />, which supports a label and an hrefforWorkspaceActions- Specifies which workspace action this extendsweight- Controls ordering within the dropdown menumeta.label- Text displayed in dropdownmeta.icon- Icon displayed alongside label
Kinds
The kind property determines the behavior and purpose of the workspace action menu item. Each kind provides specialized functionality for different use cases.
default
The default kind provides standard menu item functionality for executing custom actions.
Properties:
api- Class that extendsUmbWorkspaceActionMenuItemBaseand implements eitherexecute()orgetHref()methodmeta.label- Text displayed in the menu itemmeta.icon- Optional icon displayed alongside the label
The API class provides either a getHref() method or an execute() method. If the getHref() method is provided, the action will open the returned URL. Otherwise, the execute() method will be run when the menu item is clicked.
Use case: General purpose menu items that execute custom logic or navigate to a URL when clicked.
previewOption
The previewOption kind creates menu items for document preview scenarios, integrating with server-side URL providers to generate preview URLs for different environments.
Properties:
meta.label- Text displayed in the menu itemmeta.icon- Icon displayed alongside the labelmeta.urlProviderAlias- Alias of the server-sideIUrlProviderthat generates the preview URL
Use case: Custom preview options that open documents in different preview environments (staging, production, or custom domains).
Implementation
Create a workspace action menu item by extending UmbWorkspaceActionMenuItemBase and implementing the execute method. This provides the functionality that runs when a user interacts with the menu item:
Action Relationship
Menu items display a dropdown menu for their associated actions:
Primary Action
Menu Item Extensions
Last updated
Was this helpful?