Help¶
An overlay that auto-generates a keybinding reference from every registered component and app-level binding. Zero configuration — just add it to your app and press ?.
Implements Component, Themed, and the Overlay interface.
Construction¶
That is the entire API. The App wires the Help instance to the global ? key and populates it from the keybinding registry automatically.
How It Works¶
Every Component exposes its bindings via KeyBindings() []KeyBind. When the App initialises, it collects bindings from:
- All registered components (via
WithComponentorWithLayout) - App-level bindings added with
WithKeyBind - Built-in globals (
q,tab,?)
These are grouped by the Group field of each KeyBind and displayed in the Help overlay.
KeyBind¶
type KeyBind struct {
Key string // e.g. "up/k", "ctrl+d", "1-9"
Label string // Human-readable description
Group string // Section heading in the Help overlay
Handler func() // Called by the App on keypress (app-level bindings only)
}
Registering App-Level Bindings¶
blit.WithKeyBind(blit.KeyBind{
Key: "r",
Label: "Refresh",
Group: "DATA",
Handler: func() {
table.SetRows(fetchRows())
},
})
The binding appears in the Help overlay under the DATA section heading alongside component bindings.
Markdown Group Headings¶
Group names prefixed with md: are rendered as inline Markdown. Use this for rich section headings with bold, code spans, or links:
blit.KeyBind{
Key: "ctrl+r",
Label: "Reload config",
Group: "md:**Configuration** — runtime settings",
}
Closing the Overlay¶
The Help overlay closes on ?, Esc, or q.