help

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package help implements a help bubble which can be used to display help information such as keymaps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Key         string
	Description string
}

Entry represents a single entry in the help bubble.

type Model

type Model struct {
	Viewport    viewport.Model
	Entries     []Entry
	BorderColor lipgloss.AdaptiveColor
	Title       string
	TitleColor  TitleColor
	Active      bool
	Borderless  bool
}

Model represents the properties of a help bubble.

func New

func New(
	active, borderless bool,
	title string,
	titleColor TitleColor,
	borderColor lipgloss.AdaptiveColor,
	entries []Entry,
) Model

New creates a new instance of a help bubble.

func (*Model) GotoTop

func (m *Model) GotoTop()

GotoTop jumps to the top of the viewport.

func (*Model) SetBorderColor

func (m *Model) SetBorderColor(color lipgloss.AdaptiveColor)

SetBorderColor sets the current color of the border.

func (*Model) SetBorderless

func (m *Model) SetBorderless(borderless bool)

SetBorderless sets weather or not to show the border.

func (*Model) SetIsActive

func (m *Model) SetIsActive(active bool)

SetIsActive sets if the bubble is currently active.

func (*Model) SetSize

func (m *Model) SetSize(w, h int)

SetSize sets the size of the help bubble.

func (*Model) SetTitleColor

func (m *Model) SetTitleColor(color TitleColor)

SetTitleColor sets the color of the title.

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update handles UI interactions with the help bubble.

func (Model) View

func (m Model) View() string

View returns a string representation of the help bubble.

type TitleColor

type TitleColor struct {
	Background lipgloss.AdaptiveColor
	Foreground lipgloss.AdaptiveColor
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL