Documentation
¶
Overview ¶
Package keys provides types and function for defining user-configurable keymappings in bubbletea components. Example:
var quit = NewBinding( WithKeys("q"), WithAction(func(m tea.Model) any { return tea.Quit() }), WithHelp("q", "quit"), )
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binding ¶
Binding describes a set of keybindings and a callback to execute when pressed, along with their associated help text.
func NewBinding ¶
func NewBinding(opts ...BindingOpt) Binding
NewBinding returns a new keybinding from a set of BindingOpt options.
type BindingOpt ¶
type BindingOpt func(*Binding)
BindingOpt is an initialization option for a keybinding. It's used as an argument to NewBinding.
func WithAction ¶
func WithAction(act Action) BindingOpt
WithAction initializes a keybinding with the given callback to execute when pressed.
func WithHelp ¶
func WithHelp(k, desc string) BindingOpt
WithHelp initializes a keybinding with the given help text.
func WithKeys ¶
func WithKeys(keys ...string) BindingOpt
WithKeys initializes a keybinding with the given keystrokes.
Click to show internal directories.
Click to hide internal directories.