Represents an entry in the context menu.

Constructors

  • Creates an instance of the context menu entry.

    Parameters

    • data: ContextMenuEntryContext

      The data for the context menu entry.

      The raw data describing a single context-menu entry, before it is normalized into a ContextMenuEntry or compiled for Foundry's ContextMenu base class.

      • Optionalcallback?: ContextMenuCallback

        Handler invoked when the entry is clicked; takes precedence over functionName.

      • condition: ContextMenuCondition

        Predicate (string SafeExpression or function) gating visibility. See ContextMenuCondition.

      • OptionalfunctionName?: string

        Name of the logic method to invoke when no explicit callback is given.

      • group: SohlContextMenuSortGroup

        Sort group the entry belongs to.

      • Optionalicon?: HTMLString

        Pre-built HTML icon markup; mutually optional with iconFAClass.

      • OptionaliconFAClass?: string

        Font-Awesome CSS class used to build an icon when icon is absent.

      • id: string

        Unique identifier for the entry.

      • name: string

        Display label for the entry.

    Returns ContextMenuEntry

    If neither data.icon nor data.iconFAClass is provided.

    If neither data.callback nor data.functionName is provided.

Properties

The function to call when the menu item is clicked.

Safe-expression source determining whether this entry appears in the menu. See ContextMenuCondition.

functionName?: string

The function name to call when the entry is clicked.

group: string

Context menu group.

icon?: HTMLString

HTML icon element for the menu item.

id: string

The context menu entry identifier.

name: string

The context menu entry label.