Workspace Actions
Learn how to create workspace actions that provide primary user interactions within workspace environments.
Workspace Actions appear as buttons in the workspace footer, providing primary interaction points for workspace operations. They integrate directly with workspace contexts and can be extended with dropdown menu items.
Purpose
Workspace Actions provide:
Primary interactions prominently displayed in workspace footer
Context integration with direct access to workspace state
Extensibility through action menu items
Conditional availability based on workspace state or type
Manifest
{
type: 'workspaceAction',
kind: 'default',
name: 'Example Count Incrementor Workspace Action',
alias: 'example.workspaceAction.incrementor',
weight: 1000,
api: () => import('./incrementor-workspace-action.js'),
meta: {
label: 'Increment',
look: 'primary',
color: 'danger',
},
conditions: [
{
alias: UMB_WORKSPACE_CONDITION_ALIAS,
match: 'Umb.Workspace.Document',
},
],
}Key Properties
weight- Controls action ordering (higher appears first)meta.look- Button style:'primary','secondary','outline'meta.color- Color theme:'default','positive','warning','danger'conditions- Determines workspace availability
Implementation
Create a workspace action by extending UmbWorkspaceActionBase and implementing the execute method. This provides the functionality that runs when a user clicks the action button:
Workspace Integration
Context Access
Actions automatically have access to their workspace's contexts:
Execution Lifecycle
Actions execute when clicked
Can be async for complex operations
Have access to workspace state during execution
Can modify workspace contexts
Conditional Execution
Check workspace state before performing actions:
Action Menu Integration
Actions can be extended with dropdown menu items using forWorkspaceActions:
Action Events
Workspace actions dispatch a generic action-executed event when they complete:
Event Characteristics
Generic signal - No action-specific data included
Always dispatched - Fires on both success and failure
DOM bubbling - Event bubbles up through the workspace
No payload - Contains no information about the action or results
Listening for Action Events
Components can listen for action completion:
When to Use Events
UI cleanup - Close dropdowns, modals after action execution
General refresh - Update displays when any action completes
State synchronization - Trigger broad UI updates
Common Patterns
Entity Operations
State-Dependent Actions
Multi-Step Operations
Best Practices
Action Availability
Only show actions when they are meaningful:
Visual Hierarchy
Use appropriate styling for action importance:
Context Dependencies
Always check that the context is available before performing operations.
Last updated
Was this helpful?