Skip to content
docsv0.3.0

SelectListRenderer

Interactive selection list with keyboard navigation, filtering, and vertical scrolling. The TUI analog of pi-tui's `SelectList`. Pure renderer: the caller owns the `cursor`, `filter`, and `selected` state and mutates them from a `RetainedTuiLoop` key handler or a live component — this renderer only paints the current snapshot. Each item is `{value, label, description?}`. The list shows up to `maxVisible` rows; when the cursor moves outside the visible window the renderer scrolls to keep it centered. A `filter` prop hides items whose label/value/description do not contain the substring (case- insensitive). The selected item is marked with `›` (or `>` if the theme does not supply that symbol), unselected with ` `. Node props (all optional): - `items` array List of `{value, label, description?}|. - `cursor` int Index into the *filtered* list. Default: 0. - `filter` string Filter substring. Default: '' (no filter). - `maxVisible` int Rows to show before scrolling. Default: node height. - `selected` array Values marked as selected (multi-select). Default: []. - `emptyText` string Message when the filtered list is empty. Default: 'No matches'. - `showFilter` bool Show the filter row at the top. Default: true. - `focused` bool Override focus. Default: context.focused().

SelectListRenderer::supports()

public function supports(Milpa\Live\ValueObjects\Tui\TuiNode $node): bool

True only for `select-list` nodes — dispatch is by declared node type, never by where the node came from.

Parameters

Parameters of supports()
NameTypeDescription
$nodeMilpa\Live\ValueObjects\Tui\TuiNode

SelectListRenderer::render()

public function render(Milpa\Live\ValueObjects\Tui\TuiNode $node, Milpa\Live\ValueObjects\Tui\TuiRenderContext $context): Milpa\Live\ValueObjects\Tui\TuiFrame

Draws the filtered options with the cursor marker, scrolling the window to keep the cursor visible.

Parameters

Parameters of render()
NameTypeDescription
$nodeMilpa\Live\ValueObjects\Tui\TuiNode
$contextMilpa\Live\ValueObjects\Tui\TuiRenderContext