Blockbench Reference Docs
    Preparing search index...

    A customizable keybind

    Index

    Constructors

    • Create a keybind

      Parameters

      • Optionalkeys: KeybindKeys

        Set up the default keys that need to be pressed

        • Optionalalt?: boolean
        • Optionalctrl?: boolean
        • Optionalkey?: string | number

          Main key, can be a numeric keycode or a lower case character

        • Optionalmeta?: boolean
        • Optionalshift?: boolean
        • Optionalvariations?: Record<string, VariationModifier>
      • Optionalvariations: Record<string, VariationModifier>

      Returns Keybind

    Methods

    • Test which variation would be triggered by the event. Returns the ID of the variation if triggered

      Parameters

      • event: PointerEvent | KeyboardEvent

        The event to test

      • Optionalvariation: string

        The variation to test againts

      Returns string | boolean

    • Unassign the assigned key

      Returns this

    • Get the name of the bound key

      Parameters

      • Optionalkey: number

      Returns string

    • Get display text showing the keybind

      Parameters

      • Optionalformatted: boolean

        If true, the return string will include HTML formatting

      Returns string

    • Check if a key is assigned

      Returns boolean

    • Test if the keybind would be triggered by the event

      Parameters

      • event: PointerEvent | KeyboardEvent | WheelEvent
      • Optionalinput_type: string

      Returns boolean

    • Open a UI to let the user record a new key combination

      Returns this

    • Save any changes to local storage

      Parameters

      • Optionalsave: boolean

        Save all keybinding changes to local storage. Set to false if updating multiple at once

      Returns this

    • Assign an action to the keybind

      Parameters

      • id: string

        ID of the action

      • Optionalsub_id: string

        sub keybind ID

      Returns Keybind

    • Returns this

    • Stop recording a new key combination

      Returns this

    • Returns the label of the keybinding

      Returns string

    Properties

    action?: string
    alt: boolean
    conflict: boolean
    ctrl: boolean
    key: number
    label: string
    meta: boolean
    shift: boolean
    sub_id?: string
    variations?: Record<string, VariationModifier>