hpicker

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyMap

type KeyMap struct {
	Prev key.Binding
	Next key.Binding
}

KeyMap is the key bindings for different actions within the component.

type KeyValuePair

type KeyValuePair struct {
	Key   string
	Value any
}

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the model for the horizontal picker component.

func NewModel

func NewModel(options []KeyValuePair, opts ...Option) *Model

func (*Model) GetSelection

func (m *Model) GetSelection() KeyValuePair

func (*Model) Init

func (m *Model) Init() tea.Cmd

func (*Model) Next

func (m *Model) Next()

Next is a helper function for navigating one option forward. It will not go beyond the last option (i.e. len(options) - 1).

func (*Model) Prev

func (m *Model) Prev()

Prev is a helper function for navigating one option backward. It will not go page beyond the first option (i.e. option 0).

func (*Model) Update

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

Update is the Tea update function which binds keystrokes to pagination.

func (*Model) View

func (m *Model) View() string

View renders the cursor to a string.

type Option

type Option func(*Model)

func WithRange

func WithRange(minValue, maxValue int) Option

type Styles

type Styles struct {
	NextIndicator     string
	NextStyle         lipgloss.Style
	NextDisabledStyle lipgloss.Style

	PrevIndicator     string
	PrevStyle         lipgloss.Style
	PrevDisabledStyle lipgloss.Style

	SelectionStyle lipgloss.Style
}

func DefaultStyles

func DefaultStyles() Styles

Jump to

Keyboard shortcuts

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