Skip to main content

Module footer

Module footer 

Source
Expand description

Footer / keybind bar widget.

Renders a single-line row of keyboard shortcut hints at the bottom of the screen. Each hint is a (key, action) pair styled as:

Navigate: j/k  |  Open: Enter  |  Leader: space  |  Quit: q
^^^^^^^^^^ ^^^    ^^^^  ^^^^^                      ^^^^  ^
action     key    action key                       action separator
(dark gray)(yellow)                               (dark gray)

§Usage

// In your render function, at the bottom of the layout:
render_footer(f, chunks[FOOTER], &[
    ("j/k",   "navigate"),
    ("enter", "open"),
    ("space", "leader"),
    ("q",     "quit"),
], &theme);

The pairs are context-aware — build them based on the current app state (e.g. show different hints when a popup is open):

let mut pairs: Vec<(&str, &str)> = Vec::new();
if popup_open {
    pairs.push(("Esc",   "close"));
    pairs.push(("Enter", "confirm"));
} else {
    pairs.push(("j/k",   "navigate"));
    pairs.push(("space", "leader"));
    pairs.push(("q",     "quit"));
}
render_footer(f, footer_area, &pairs, &theme);

§Optional right-hand label

Use render_footer_with_app to also show an app name + version pinned to the right edge (as rad does):

render_footer_with_app(f, chunks[FOOTER], &pairs, "myapp", "1.0.0", &theme);

Functions§

keybind_spans
Build the Vec<Span> for a keybind bar without rendering it.
render_footer
Render a keybind bar from a list of (key, action) pairs.
render_footer_with_app
Like render_footer but also renders "name version" right-aligned.