Skip to content

KeybindBar

final class Phui\Components\KeybindBar

A hint bar built from the active keymap — the keypress bindings currently reachable, each rendered as its key label followed by its description. It reads that keymap itself, so it takes no props for its content and updates as focus moves. Takes no focus itself.

Spaces inside an entry are non-breaking, so the bar only ever wraps between entries and a keybind never gets split from its description.

A hint bar listing four keys and their descriptions

php
use Phui\Components\KeybindBar;

KeybindBar::mount()->props(separator: ' • ');

The keymap runs from the focused component up through its ancestors and then over the global bindings, and the first claim on a key wins — so a key a nested component has taken is not listed again for an ancestor. Only bindings given a description appear; leave it off a Binding to keep it out of the bar.

Props

PropTypeDefaultDescription
separatorstring' 'Drawn between entries.

Colours

Phui\Components\Colours\KeybindBarColours

ColourPalette defaultUsed for
keyaccentThe key labels, which are also bold.
descriptionmutedThe descriptions.

Released under the MIT License.