Wiki 9Minecraft Wiki 9Minecraft

Input Keys and Dynamic Button Prompts

Display dynamic keyboard, mouse, controller, and touch icons inside Bedrock text strings.

5Sections
2Code examples
3Known errors

Input keys are special text tokens that Minecraft Bedrock replaces at runtime with the player's current control bindings or controller button glyphs. You reach for them when writing tutorials, custom UI prompts, actionbar hints, or dialogue where hardcoding a key like 'Right-Click' or 'Space' would break for players on gamepads, touchscreens, or remapped keyboards.

How Input Key Tokens Work

Because Minecraft Bedrock runs across desktop, mobile, and consoles, players rarely share the exact same physical controls. Even on a single platform, a player might remap their jump or interact keys in the settings menu. If you write a static tutorial message telling the player to press the W key, anyone using a controller or touch screen gets a confusing prompt.

To solve this, the text rendering engine listens for tokens wrapped in colons that begin with the prefix :_input_key. followed by the internal name of an action. When the engine draws a string containing one of these tokens, it looks up the active input mode of the local player. If the player is on a keyboard and mouse, the token expands into the localized name of the bound key, such as [W] or [Button 2]. If the player is holding a gamepad, the engine swaps the token for a bitmap glyph from the active resource pack's controller font sheet, drawing the actual Xbox, PlayStation, or Switch button icon inline with your text.

This replacement happens purely on the client side during text layout. That means the same server-side command, script, or localization entry can broadcast a single string to every connected player, and each client will render the exact button or key appropriate for their own hardware and settings.

Common Input Key Identifiers

Every input token corresponds to an internal control binding registered by the game client. The token must start and end with a colon, with no spaces inside. Below are the most reliable input key tokens used across vanilla strings and custom add-ons.

TokenDefault ActionNotes
:_input_key.forward:Move ForwardDefaults to W on keyboard; left stick up on controller.
:_input_key.back:Move BackwardDefaults to S on keyboard.
:_input_key.left:Strafe LeftDefaults to A on keyboard.
:_input_key.right:Strafe RightDefaults to D on keyboard.
:_input_key.jump:Jump / Swim Up / Fly UpDefaults to Space on keyboard; bottom face button on controller.
:_input_key.sneak:Sneak /Crouch / Fly DownDefaults to Shift on keyboard.
:_input_key.sprint:SprintDefaults to Ctrl on keyboard.
:_input_key.attack:Attack / DestroyDefaults to Left-Click (Button 1) on mouse; right trigger on controller.
:_input_key.use:Use Item / Place Block / InteractDefaults to Right-Click (Button 2) on mouse; left trigger on controller.
:_input_key.drop:Drop Selected ItemDefaults to Q on keyboard.
:_input_key.inventory:Open InventoryDefaults to E on keyboard.
:_input_key.chat:Open ChatDefaults to T or Return on keyboard.
:_input_key.mobEffects:View Mob EffectsDefaults to Z on keyboard; D-pad left on controller.
:_input_key.pickItem:Pick BlockDefaults to Middle-Click (Button 3) on mouse; unbound by default on gamepad.

Using Input Keys in Localization Files

The cleanest place to put input key tokens is inside your resource pack's language (.lang) files. Storing prompts in localization keys keeps your behavior pack files clean and lets translators move the button prompt around to match the grammar of different languages.

When you include an input key token inside a .lang file, you can combine it with standard %s or %1 placeholder tokens or just drop it directly into the translated sentence. You should also append a comment starting with a tab and a hash symbol (###) on the same line if you need to leave context for translators, ensuring they do not accidentally translate the internal token name.

RP/texts/en_US.lang
action.hint.exit.custom_seat=Tap :_input_key.sneak: to dismount the cannon
tutorial.hint.fire_weapon=Aim at the target and press :_input_key.attack: to fire!
tutorial.hint.reload_weapon=Hold :_input_key.use: while holding ammo to reload.

Displaying Prompts via Rawtext and Commands

You do not have to use a resource pack to render input keys. Any command or component that accepts rawtext JSON—such as /titleraw, /tellraw, NPC dialogue, or the @minecraft/server Script API—can render input tokens directly inside a raw text string or by referencing a translation key via the translate component.

Below is an example of a behavior pack NPC dialogue scene that uses rawtext to display an input prompt directly inside the NPC's speech bubble, alongside a button command that pushes an actionbar reminder to the player.

BP/dialogue/weapon_master.json
{
  "format_version": "1.17.0",
  "minecraft:npc_dialogue": {
    "scenes": [
      {
        "scene_tag": "combat_training_intro",
        "npc_name": "Weapon Master",
        "text": {
          "rawtext": [
            {
              "text": "Welcome to the range. Walk up to the dummy using "
            },
            {
              "text": ":_input_key.forward: "
            },
            {
              "text": "and strike it with "
            },
            {
              "text": ":_input_key.attack:"
            },
            {
              "text": " when you are ready."
            }
          ]
        },
        "buttons": [
          {
            "name": "Got it",
            "commands": [
              "/titleraw @initiator actionbar {\"rawtext\":[{\"translate\":\"tutorial.hint.fire_weapon\"}]}"
            ]
          }
        ]
      }
    ]
  }
}

Touch Controls and Formatting Caveats

While input keys automatically adapt between keyboard and controller, touch screens require extra care. On mobile devices using standard touch controls, several actions do not have a dedicated virtual button on screen at all times—for example, attacking and interacting are performed by tapping or long-pressing the world rather than pressing a labeled key. Depending on which touch control scheme the player has selected (such as Touch, Crosshair, or Joystick), some input tokens may render as a touch icon, while others may fall back to blank text or generic labels.

If your add-on heavily targets mobile players and relies on complex prompts, test your strings across all three touch control modes. When you need completely separate phrasing for touch versus controller (for example, saying 'Tap the screen' instead of 'Press :_input_key.attack:'), note that a single static string cannot rewrite surrounding verbs automatically unless you swap the string via script using the player's input permissions or platform info.

Finally, keep in mind how Minecraft section-sign (§) formatting codes interact with input tokens. If you place a color code like §e right before :_input_key.jump:, a keyboard prompt like [Space] will adopt the yellow color, whereas a controller button glyph may either remain in its native full-color sprite or become tinted by the color code depending on the UI context. To keep controller icons crisp and readable, reset your formatting with §r immediately before the input key token, and reapply your text color right after the closing colon.

Which versions this applies to

Applies to Minecraft Bedrock 1.16.0 and newer in stable builds. No experimental toggles are required.

When it does not work

What you seeWhyThe fix
The game displays the literal text ':_input_key.interact:' on screen instead of a button icon or key name.There is no internal binding named 'interact'. The engine leaves unrecognized or misspelled input tokens untouched as plain text. Another common cause is writing the action name in the wrong case, such as ':_input_key. pickitem:' instead of camelCase.Replace ':_input_key.interact:' with ':_input_key.use:', and ensure multi-word keys use exact camelCase like ':_input_key.pickItem:' or ':_input_key.mobEffects:' with no spaces inside the colons.
The controller button icon looks dark, muddied, or tinted purple/red inside custom chat or actionbar text.A color formatting code (such as §5 or §c) placed earlier in the sentence is still active when the font renderer draws the controller glyph bitmap, multiplying the vertex color over the sprite.Wrap the token with a formatting reset: write '§cPress §r:_input_key.attack:§c to strike' so the glyph renders with neutral white vertex coloring.
The prompt shows an empty gap or nothing at all for a specific action when testing on a gamepad.The player's current input device does not have that specific action bound to any physical button by default (for example, ':_input_key.pickItem:' or ':_input_key.chat:' may be unbound on certain controller presets).Stick to core bindings that are guaranteed to be mapped on all platforms (movement, jump, sneak, attack, use) for mandatory gameplay mechanics, or remind players in your pack description if they must bind Pick Block manually.

Reference, straight from the game files

Read out of the game itself, so the ids match the version you are building for.