picker

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package picker is a vertical, type-to-filter select list for modal choices (workflow transitions today; assignees, labels and facet values next). Typing narrows the list fzf-style through the shared input substrate, up/down move the cursor, and the caller reads Selected() on its own submit key — the picker never consumes enter or esc.

primer was considered first per the project rule: its picker package is a settings grid (label rows with horizontal choice cycling) and its pick package is a blocking huh form that owns the terminal — neither embeds in a running Bubble Tea program as a select list, so this stays in-tree on the existing input.Line substrate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Label string
	Value string
}

Item is one selectable entry: Label is shown, Value is what the caller receives (e.g. a transition ID behind its display name).

type Model

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

Model is the picker state. Construct with New.

func New

func New(title string, items []Item) Model

New builds a picker over items with the cursor on the first entry and an empty (all-matching) filter.

func (*Model) Move

func (m *Model) Move(delta int)

Move shifts the cursor by delta within the current matches, clamped.

func (Model) Selected

func (m Model) Selected() (Item, bool)

Selected returns the item under the cursor; ok is false when nothing matches the filter (or the picker is empty).

func (*Model) Update

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

Update routes navigation to the cursor and everything else (typing, paste, cursor movement inside the filter) to the filter input. Enter and esc are deliberately not handled — submit/cancel belong to the caller.

func (Model) View

func (m Model) View() string

View renders the title, the filter line (once the user typed something), and the matching items with a cursor marker.

Jump to

Keyboard shortcuts

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