Represents a user-triggerable action that can be displayed in various UI contexts.

Actions are the primary way to expose functionality to users through the UI. They can appear as:

  • Toolbar buttons
  • Dropdown menu options
  • Quick action buttons

Each action wraps a command that executes when the action is triggered. Actions can be conditionally shown or hidden using Conditions, and they support rich metadata like icons, labels, and descriptions for better UX.

The generic type parameter T allows you to specify the exact command type, enabling type-safe action definitions for specific contexts like single objects or bulk operations.

Example

Basic action with icon and label

const actions = [
{
label: 'Save',
icon: 'save',
command: new SaveRecordCommand()
},
{
label: 'Delete',
icon: 'trash',
command: new DeleteRecordCommand()
}
];

Example

Conditional action with icon-only display

const canSendEmail = {
id: 'contact.can-send-email',
type: 'limeobject',
evaluate: (contact) => contact.email && contact.email.length > 0
};

const sendEmailAction = {
label: 'Send Email',
icon: 'envelope',
hideLabel: true,
command: new SendEmailCommand(),
condition: canSendEmail
};

Example

Action with description and disabled state

const exportAction = {
label: 'Export to Excel',
description: 'Download this record as an Excel spreadsheet',
icon: 'file-excel',
command: new ExportExcelCommand(),
disabled: !object || !object.id
};

See

Type Parameters

Hierarchy

  • Action

Properties

command: T

The command to execute when the action is activated.

This command will be dispatched to the CommandBus when the user triggers the action. The command type determines what operation will be performed (e.g., save, delete, export, send email).

See

condition?: Condition<unknown>

Optional condition that determines whether the action is available.

If provided, the condition's evaluate function will be called to determine if the action should be shown or enabled. If the condition evaluates to false, the action is typically hidden from the UI.

This is particularly useful for:

  • Showing actions only for objects in specific states
  • Permission-based action visibility
  • Context-dependent action availability

Example

const canDelete: LimeObjectCondition = {
id: 'record.can-delete',
type: 'limeobject',
evaluate: (obj) => !obj.locked
};

const deleteAction: LimeObjectAction = {
label: 'Delete',
command: new DeleteObjectCommand(),
condition: canDelete
};

See

Condition

description?: string

Additional descriptive text explaining what the action does.

Descriptions provide more context than labels alone and are typically displayed in:

  • Tooltips on hover
  • Help text in configuration dialogs
  • Extended menu descriptions

Use descriptions to clarify the action's purpose or any side effects.

Example

{
label: 'Export to Excel',
description: 'Download all selected records as an Excel spreadsheet',
command: { name: 'export-excel' }
}
disabled?: boolean

Controls whether the action is disabled (grayed out but visible).

When true, the action is shown in the UI but cannot be triggered. This is different from hiding the action entirely (using condition).

Use disabled state to:

  • Indicate that an action exists but is temporarily unavailable
  • Show what actions would be available in different contexts
  • Provide better user feedback than simply hiding the action

Example

{
label: 'Save',
icon: 'save',
command: new SaveCommand(),
disabled: !this.hasUnsavedChanges
}
hideLabel?: boolean

Controls whether the action's label should be hidden in the UI.

When true, only the icon is displayed, creating a more compact interface. However, the label should still be provided for:

  • Accessibility (screen readers)
  • Tooltips on hover
  • Alternative display contexts (e.g., dropdown menus)

Icon-only actions work best in toolbars where space is limited and icons are easily recognizable.

icon?: string | Icon

Icon to display with the action.

Can be either a string referencing an icon name from the platform's icon library, or an Icon object with additional properties like color.

Icons help users quickly identify actions and improve visual scannability of action menus and toolbars.

See

Icon

label?: string

Display label for the action.

This text is shown to the user in menus, buttons, or tooltips. The label is automatically translated using the platform's Translator service, so you should provide translation keys rather than hardcoded strings.

Even if hideLabel is true, you should still provide a label for accessibility and alternative display contexts.

See

Translator