etui/widgets/help

Types

A single key binding. Multiple keys for the same action go in keys.

pub type Binding {
  Binding(keys: List(String), description: String)
}

Constructors

  • Binding(keys: List(String), description: String)
pub type Help {
  Help(
    bindings: List(Binding),
    mode: HelpMode,
    separator: String,
    key_fg: style.Color,
    description_fg: style.Color,
    bg: style.Color,
  )
}

Constructors

pub type HelpMode {
  Short
  Full
}

Constructors

  • Short

    One line: k1/k2 desc • k3 desc.

  • Full

    Two columns, one binding per row.

Values

pub fn binding(
  keys: List(String),
  description: String,
) -> Binding

Shorthand for building a Binding.

pub fn help_new(bindings: List(Binding)) -> Help

A short-mode help line with " • " separators and dimmed descriptions.

pub fn render(
  buf: buffer.Buffer,
  area: geometry.Rect,
  h: Help,
) -> buffer.Buffer

Render the help view in its current mode.

pub fn toggle_mode(h: Help) -> Help

Flip between Short and Full; handy for a toggle key.

pub fn with_bg(h: Help, bg: style.Color) -> Help

Background of the whole view.

pub fn with_description_color(h: Help, fg: style.Color) -> Help

Color of the descriptions.

pub fn with_key_color(h: Help, fg: style.Color) -> Help

Color of the key names.

pub fn with_mode(h: Help, mode: HelpMode) -> Help

Switch between the one-line and two-column layouts.

pub fn with_separator(h: Help, sep: String) -> Help

String joined between entries in Short mode (default " • ").

✨ Search Document