Blockbench Reference Docs
    Preparing search index...

    Actions can be triggered to run something, they can be added to menus, toolbars, assigned a keybinding, or run via Action Control

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    category?: string
    children?: any[] | ((context: any) => any[])
    click: (event?: Event) => void
    color?: string
    default_keybind?: Keybind
    description: string
    events: Record<string, EventListener[]>
    icon?: string | (() => string)
    icon_node: HTMLElement
    id: string
    keybind: Keybind
    menu_node: HTMLElement
    menus: { menu: Menu; path: string }[]
    name: string
    node: HTMLElement
    nodes: HTMLElement[]
    onClick: any
    plugin?: string

    The plugin that this was added by

    searchable?: boolean
    side_menu?: Menu | Dialog | ToolConfig

    Provide a menu that belongs to the action, and gets displayed as a small arrow next to it in toolbars.

    sub_keybinds?: Record<string, SubKeybind>
    tool_config?: ToolConfig

    Provide a window with additional configutation related to the action

    toolbars: Toolbar[]
    type: string
    uniqueNode?: boolean
    variations?: { [key: string]: { description?: string; name: string } }
    work_in_dialog?: boolean
    constructing: BarItem

    Methods

    • Adds a label to the HTML element of the bar item

      Parameters

      • Optionalin_bar: boolean

        Set to true to generate an in-bar label, as opposed to a regular on-hover label

      • Optionalaction: any

        Provide the action to generate the label. This defaults to self and is only needed in special cases

      Returns void

    • Parameters

      • id: string
      • name: string
      • default_keybind: Keybind
      • trigger: any

      Returns void

    • Returns boolean

    • Returns void

    • Parameters

      • event_name: string
      • data: any

      Returns any

    • Gets a copy of the elements HTML node that is not yet in use.

      Parameters

      • ignore_disconnected: any

      Returns HTMLElement

    • Parameters

      Returns void

    • Change the icon of the action

      Parameters

      • icon: string

      Returns void

    • Change the name of the action

      Parameters

      • name: string

      Returns void

    • Appends the bar item to a HTML element

      Parameters

      • destination: string | HTMLElement

      Returns this

    • Trigger to run or select the action. This is the equivalent of clicking or using a keybind to trigger it. Also checks if the condition is met.

      Parameters

      Returns boolean

    • Returns this