TermUI.Widget.PickList (TermUI v0.2.0)
View SourceA modal pick-list widget for selecting from a list of items.
PickList displays a centered modal overlay with a scrollable list, keyboard navigation, and type-ahead filtering. Used for provider and model selection dialogs.
Usage
PickList.render(%{
items: ["Apple", "Banana", "Cherry"],
title: "Select Fruit",
on_select: fn item -> IO.puts("Selected: #{item}") end,
on_cancel: fn -> IO.puts("Cancelled") end
}, state, area)Props
:items- List of items to display (required):title- Modal title (optional):on_select- Callback when item selectedfn item -> ... end:on_cancel- Callback when cancelledfn -> ... end:width- Modal width (default: 40):height- Modal height (default: 10):style- Border/text style options:highlight_style- Style for selected item (default: inverted colors)
Keyboard Controls
Up/Down- Navigate itemsPage Up/Down- Jump 10 itemsHome/End- Jump to first/last itemEnter- Confirm selectionEscape- Cancel- Typing - Filter items (type-ahead search)
Backspace- Remove filter character
Summary
Functions
Handles keyboard events for the pick-list.
Handles messages to the pick-list.
Initializes the pick-list state.
Renders the pick-list modal.