Widgets / Badge & KeyHint

Badge & KeyHint

A pill label and a key+description hint for status bars and help rows.

Badge · KeyHint NEW 12 ⏎ submit^C quit

Signature

Badge.badge (style: Style) (label: string) : LayoutNode<'msg>
KeyHint.hint (keyStyle: Style) (labelStyle: Style) (key: string) (label: string) : LayoutNode<'msg>

Parameters

parameter type what it is
style Style Badge: pass a background-bearing style (e.g. theme.accentStrong) so the pill reads.
key string KeyHint: the key glyph, e.g. "⏎" or "^C".
label string The badge text, or the hint's description.

Example

Stack.hstack
    [ Badge.badge theme.accentStrong "NEW"
      Text.text "   " theme.fg
      KeyHint.hint theme.key theme.fgMuted "^S" "save" ]