dropdown

package
v0.0.0-...-b830f6f Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelledMsg

type CancelledMsg struct{}

CancelledMsg is sent when the dropdown is cancelled

type KeyMap

type KeyMap struct {
	Up     key.Binding
	Down   key.Binding
	Enter  key.Binding
	Escape key.Binding
}

KeyMap defines the key bindings for the dropdown

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default key bindings

type Model

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

Model represents the dropdown component

func New

func New(options []Option) Model

New creates a new dropdown model

func (*Model) Close

func (m *Model) Close()

Close closes the dropdown

func (*Model) GetSelectedIndex

func (m *Model) GetSelectedIndex() int

GetSelectedIndex returns the currently selected index

func (*Model) GetSelectedOption

func (m *Model) GetSelectedOption() Option

GetSelectedOption returns the currently selected option

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the dropdown

func (*Model) IsOpen

func (m *Model) IsOpen() bool

IsOpen returns whether the dropdown is open

func (*Model) Open

func (m *Model) Open()

Open opens the dropdown

func (*Model) SetOptions

func (m *Model) SetOptions(options []Option)

SetOptions updates the dropdown options

func (*Model) SetPlaceholder

func (m *Model) SetPlaceholder(placeholder string)

SetPlaceholder sets the placeholder text

func (*Model) SetSelectedIndex

func (m *Model) SetSelectedIndex(index int)

SetSelectedIndex sets the selected index

func (*Model) SetSelectedValue

func (m *Model) SetSelectedValue(value interface{})

SetSelectedValue sets the selected option by value

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

SetSize sets the dropdown dimensions

func (*Model) SetTitle

func (m *Model) SetTitle(title string)

SetTitle sets the dropdown title

func (Model) Update

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

Update handles messages

func (Model) View

func (m Model) View() string

View renders the dropdown

type Option

type Option struct {
	Label string
	Value interface{}
}

Option represents a dropdown option

type SelectedMsg

type SelectedMsg struct {
	Option Option
	Index  int
}

SelectedMsg is sent when an option is selected

Jump to

Keyboard shortcuts

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