Documentation
¶
Overview ¶
Package help renders a toggleable help overlay showing key bindings, modeled on pug's help widget. Pass in a []key.Binding and get back a bordered string that shows key/description columns flowed to fit the available width.
Components that want to contribute their own bindings can implement the Provider interface; the parent collects bindings from the focused child and passes them in via SetBindings before rendering.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model renders a help overlay. Call SetBindings to change what it shows and SetDimensions on window resize. Visibility is the parent's concern: render the View() string only when help should appear.
func (*Model) SetBindings ¶
func (*Model) SetDimensions ¶
func (Model) ShortView ¶
ShortView renders the current bindings as a single inline line — "key desc <sep> key desc <sep> ..." — using KeyStyle and DescStyle.
The separator and the space between each key and its description are rendered through DescStyle so that any background color set on DescStyle extends across the whole line with no gaps. When embedding in a colored status bar, give KeyStyle and DescStyle the same Background as the bar.
type Options ¶
type Options struct {
// Width and Height are the outer dimensions of the overlay, including the
// border.
Width, Height int
// KeyStyle is applied to the key column (left side of each pair).
KeyStyle lipgloss.Style
// DescStyle is applied to the description column.
DescStyle lipgloss.Style
// Border is the overlay's border. Defaults to lipgloss.NormalBorder().
Border lipgloss.Border
// BorderColor colors the border. Defaults to "240" (dim grey).
BorderColor lipgloss.TerminalColor
// ColumnSpacer is placed between column-pairs in the overlay. Defaults
// to " ".
ColumnSpacer string
// ShortSeparator is placed between bindings in ShortView. Defaults to
// " • ".
ShortSeparator string
}
Options configures a help overlay. Zero-value fields fall back to defaults.