sortmenu

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package sortmenu provides a popup sort column selector for table views. Follows the actionmenu pattern: renders as centered overlay with hotkey selection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SortColumn

type SortColumn struct {
	Label    string // Display text (column title)
	ColIndex int    // Index into visible columns (for sorting Row.Data)
}

SortColumn represents a sortable column entry in the menu.

type SortMenu

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

SortMenu is the popup sort column selector.

func New

func New(columns []SortColumn, activeColIndex int, activeAsc bool) *SortMenu

New creates a new sort menu from a list of sortable columns. activeColIndex is the currently sorted column (-1 for none).

func (*SortMenu) GetColumns

func (m *SortMenu) GetColumns() []SortColumn

GetColumns returns the columns (for testing).

func (*SortMenu) GetCursor

func (m *SortMenu) GetCursor() int

GetCursor returns the current cursor position (for testing).

func (*SortMenu) Update

func (m *SortMenu) Update(msg tea.Msg) tea.Cmd

Update handles input for the sort menu.

func (*SortMenu) View

func (m *SortMenu) View() string

View renders the sort menu.

type SortMenuClosedMsg

type SortMenuClosedMsg struct{}

SortMenuClosedMsg is emitted when the menu is closed without selection.

type SortSelectedMsg

type SortSelectedMsg struct {
	ColIndex  int
	Ascending bool
}

SortSelectedMsg is emitted when a sort column is selected.

type Styles

type Styles struct {
	Container     lipgloss.Style
	Title         lipgloss.Style
	Key           lipgloss.Style
	KeySelected   lipgloss.Style
	Label         lipgloss.Style
	LabelSelected lipgloss.Style
	Indicator     lipgloss.Style
	Divider       lipgloss.Style
	Help          lipgloss.Style
}

Styles holds sort menu styles.

func DefaultStyles

func DefaultStyles() Styles

DefaultStyles returns the default sort menu styles.

Jump to

Keyboard shortcuts

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