Blockbench Reference Docs
    Preparing search index...

    Class BarMenu

    Creates a new menu in the menu bar

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    condition?: any
    id: string
    name: string
    plugin?: string

    The ID of the plugin that created the object

    structure: MenuItem[]
    type: "bar_menu"

    Methods

    • Adds an action to the menu structure

      Parameters

      • action: Action | CustomMenuItem

        Action to add

      • Optionalpath: string | number

        Path pointing to the location. Use the ID of each level of the menu, or index within a level, separated by a point. For example, export.0 places the action at the top position of the Export submenu.

      Returns void

    • Opens the menu somewhere

      Parameters

      • position: HTMLElement | MouseEvent

        Position where to open the menu. Can be a mouse event, or a node that the menu is spawned below.

      • Optionalcontext: any

        Context for the click events inside the menu

      Returns this

    • Parameters

      • path: string | Action

        Path pointing to the location. Use the ID of each level of the menu, or index within a level, or item ID, separated by a point. For example, export.export_special_format removes the action "Export Special Format" from the Export submenu.

      Returns void

    • Alias for .open()

      Parameters

      • position: HTMLElement | MouseEvent
      • Optionalcontext: any

      Returns this