Blockbench Reference Docs
    Preparing search index...

    A toggle is a type of action that can be on or off. The state is not persistent between restarts by default.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    category?: string
    click: (event?: Event) => void

    Type Declaration

      • (event?: Event): void
      • Function to run when user uses the action successfully

        Parameters

        Returns void

    condition?: any
    description: string
    icon: string | (() => selected_layer)
    id: string
    keybind: Keybind
    linked_setting?: string

    ID of a setting that the toggle is linked to

    menu_node: HTMLElement
    name: string
    node: HTMLElement
    nodes: HTMLElement[]
    plugin?: string

    The ID of the plugin that created the object

    side_menu?: Menu | ToolConfig

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

    tool_config?: ToolConfig

    Provide a window with additional configutation related to the action

    value: boolean
    variations?: { [key: string]: { description?: string; name: string } }
    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

    • 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

    • 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