Widgets / Completion

Completion

A cursor-anchored, bordered suggestion list that clamps on-screen.

Completion┌────────────────────────────┐│/help ││/model (selected) ││/clear ││/quit │└────────────────────────────┘

Signature

Completion.view
    (areaW: int) (areaH: int)
    (anchorX: int) (anchorY: int)
    (width: int) (maxRows: int)
    (borderStyle: Style) (selStyle: Style) (rowStyle: Style)
    (selected: int) (items: string list)
    : LayoutNode<'msg>

Parameters

parameter type what it is
areaW / areaH int The screen size, so the popup can clamp itself on-screen.
anchorX / anchorY int The caret position; the popup sits below it, flipping above when low on space.
width / maxRows int Popup width and the most rows to show.
selected int The highlighted item; items is your filtered candidate list.

Notes

You filter the candidates and track the selection; the widget places and draws the popup. For a Ctrl+P command surface use CommandPalette.view; CommandPalette.filter query candidates is the reusable fuzzy ranker.