Skip to main content

Behaviors Overview

"Behaviors" are bindings that are assigned to and triggered by key positions on keymap layers, sensors (like an encoder) or combos. They describe what happens e.g. when a certain key position is pressed or released, or an encoder triggers a rotation event. They can also be recursively invoked by other behaviors, such as macros.

Below is a summary of pre-defined behavior bindings and user-definable behaviors available in ZMK, with references to documentation pages describing them.

Key Press Behaviors

BindingBehaviorDescription
&kpKey PressSend keycodes to the connected host when a key is pressed
&mtMod TapSends a different key press depending on whether a key is held or tapped
&ktKey ToggleToggles the press of a key. If the key is not currently pressed, key toggle will press it, holding it until the key toggle is pressed again or the key is released in some other way. If the key is currently pressed, key toggle will release it
&skSticky KeyStays pressed until another key is pressed, then is released. It is often used for modifier keys like shift, which allows typing capital letters without holding it down
&grescGrave EscapeSends Grave Accent ` keycode if shift or GUI is held, sends Escape keycode otherwise
&caps_wordCaps WordBehaves similar to caps lock, but automatically deactivates when any key not in a continue list is pressed, or if the caps word key is pressed again
&key_repeatKey RepeatSends again whatever keycode was last sent

Miscellaneous Behaviors

BindingBehaviorDescription
&transTransparentPasses the key press down to the next active layer in the stack for processing
&noneNoneSwallows and stops the key press, no keycode will be sent nor will the key press be passed down to the next active layer in the stack

Layer Navigation Behaviors

BindingBehaviorDescription
&moMomentary LayerEnables a layer while a key is pressed
&ltLayer-tapEnables a layer when a key is held, and outputs a key press when the key is only tapped for a short time
&toTo LayerEnables a layer and disables all other layers except the default layer
&togToggle LayerEnables a layer until the layer is manually disabled
&slSticky LayerActivates a layer until another key is pressed, then deactivates it

Mouse Emulation Behaviors

BindingBehaviorDescription
&mkpMouse Button PressEmulates pressing mouse buttons

Reset Behaviors

BindingBehaviorDescription
&sys_resetResetResets the keyboard and re-runs the firmware flashed to the device
&bootloaderBootloaderResets the keyboard and puts it into bootloader mode, allowing you to flash new firmware

Output Selection Behaviors

BindingBehaviorDescription
&btBluetoothCompletes a bluetooth action given on press, for example switching between devices
&outOutput SelectionAllows selecting whether output is sent to the USB or bluetooth connection when both are connected

Lighting Behaviors

BindingBehaviorDescription
&rgb_ugRGB UnderglowControls the RGB underglow, usually placed underneath the keyboard
&blBacklightControls the keyboard backlighting, usually placed through or under switches

Power Management Behaviors

BindingBehaviorDescription
&ext_powerPower managementAllows enabling or disabling the VCC power output to save power
&soft_offSoft offTurns the keyboard off.

ZMK Studio Behaviors

BindingBehaviorDescription
&studio_unlockZMK Studio UnlockUnlocks the device so that ZMK Studio UI can make changes

User-Defined Behaviors

BehaviorDescription
MacrosAllows configuring a list of other behaviors to invoke when the key is pressed and/or released
Hold-TapInvokes different behaviors depending on key press duration or interrupting keys. This is the basis for layer-tap and mod-tap
Tap DanceInvokes different behaviors corresponding to how many times a key is pressed
Mod-MorphInvokes different behaviors depending on whether a specified modifier is held during a key press
Sensor RotationInvokes different behaviors depending on whether a sensor is rotated clockwise or counter-clockwise